Google::Adwords::CreativeService - Interact with the Google Adwords CreativeService API calls
This documentation refers to Google::Adwords::CreativeService version 0.3.1
use Google::Adwords::CreativeService; use Google::Adwords::Image; use Google::Adwords::Creative; use File::Slurp; # create the CreativeService object my $creative_service = Google::Adwords::CreativeService->new(); # need to login to the Adwords service $creative_service->email($email_address) ->password($password) ->developerToken($developer_token) ->applicationToken($app_token); # if you have a MCC $creative_service->clientEmail($client_email); # or $creative_service->clientCustomerId($customerid); my $adgroupid = 123456789; # get all the creatives for an adgroup my @getallcreatives = $creative_service->getAllCreatives($adgroupid); for ( @getallcreatives ) { print "Creative name : " . $_->name . " , Id : " . $_->id . "\n"; } # get a specific creative from an AdGroup my $creativeid = 987654321; my $getcreative = $creative_service->getCreative($adgroupid, $creativeid); print "Get creative: " . $getcreative->name . ", Id : " . $getcreative->id . "\n"; # add a creative my $creative_text = Google::Adwords::Creative->new ->adGroupId($adgroupid) ->destinationUrl('http://www.example.com') ->displayUrl('http://www.example.com') ->headline('API : creative') ->description1('desc1 added via API') ->description2('desc2 added via API'); my $addcreative = $creative_service->addCreative($creative_text); print "Added Creative ID: " . $addcreative->id . "\n"; # add a image creative my $data_blurb = read_file('image.gif'); my $image = Google::Adwords::Image->new ->name('Image #1') ->data($data_blurb) ->type('image'); my $creative_image = Google::Adwords::Creative->new ->adGroupId($adgroupid) ->destinationUrl('http://www.example.com') ->displayUrl('http://www.example.com') ->image( $image ); my $addcreative = $creative_service->addCreative($creative_image); print "Added Creative ID: " . $addcreative->id . "\n"; print "Image Height: " . $addcreative->image->height . "\n";
This module provides an interface to the Google Adwords CreativeService API calls. Please read Google::Adwords::Creative on how to setup and receive information about your creatives.
Make a new Creative. The Creative can either be a text Creative or an image.
my $creative_response = $obj->addCreative($creative);
$creative => A Google::Adwords::Creative object
$creative_response => The newly added creative as a Google::Adwords::Creative object
Make a batch of new Creatives.
my @creatives = $obj->addCreativeList($creative1, $creative2);
A list of Google::Adwords::Creative objects
The list of created creatives, each as a Google::Adwords::Creative object
Return all active Creatives associated with an AdGroup.
my @creatives = $obj->getActiveCreatives($adgroupid);
1) $adgroupid : the id of the AdGroup.
A list of Google::Adwords::Creative objects.
Return all Creatives (active and deleted) associated with an AdGroup
my @creatives = $obj->getAllCreatives($adgroupid);
Return information about one Creative.
my $creative = $obj->getCreative($adgroupid, $creativeid);
$creative => The creative info as a Google::Adwords::Creative object
Get statistics for a list of Creatives. See Google::Adwords::StatsRecord for details about the statistics returned. The time granularity is one day.
Also see -
http://www.google.com/apis/adwords/developer/StatsRecord.html
my @creative_stats = $obj->getCreativeStats({ adGroupId => 1234 creativeIds => [ 3982, 2787, 17872 ], startDay => $startDay, endDay => $endDay, inPST => 1, });
Takes a hashref with following keys,
* adGroupId => The ad group that contains the creative to be queried
* creativeIds => array reference of creative ids
* startDay => The starting day of the period for which statistics are to be collected in format YYYY-MM-DD
* endDay => The ending day of the period for which statistics are to be collected in format YYYY-MM-DD
* inPST => Set to 1 to get stats in America/Los_Angeles timezone (Google headquarters) regardless of the parent account's localtimezone.
A list of Google::Adwords::StatsRecord objects; one for each creative.
Google::Adwords::Creative
Google::Adwords::Image
Google::Adwords::StatsRecord
Rohan Almeida <rohan@almeida.in>
Mathieu Jondet <mathieu@eulerian.com>
Copyright (c) 2006 Rohan Almeida <rohan@almeida.in>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install Google::Adwords, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Google::Adwords
CPAN shell
perl -MCPAN -e shell install Google::Adwords
For more information on module installation, please visit the detailed CPAN module installation guide.