GOOGLE-ADWORDS-PERL-CLIENT

 view release on metacpan or  search on metacpan

examples/v201309/account_management/get_account_changes.pl  view on Meta::CPAN

             $campaign_changes->get_campaignChangeStatus();
      if ($campaign_changes->get_campaignChangeStatus() ne "NEW") {
        printf "\tAdded ad extensions: %s\n",
               get_formatted_list($campaign_changes->get_addedAdExtensions());
        printf "\tAdded campaign criteria: %s\n",
               get_formatted_list(
                  $campaign_changes->get_addedCampaignCriteria());
        printf "\tAdded campaign targeting: %s\n",
               $campaign_changes->get_campaignTargetingChanged() ? "yes" : "no";
        printf "\tDeleted ad extensions: %s\n",
               get_formatted_list($campaign_changes->get_deletedAdExtensions());
        printf "\tDeleted campaign criteria: %s\n",
               get_formatted_list($campaign_changes->
                   get_deletedCampaignCriteria());

        if ($campaign_changes->get_changedAdGroups()) {
          foreach my $ad_group_changes
              (@{$campaign_changes->get_changedAdGroups()}) {
            printf "\tAd group with id \"%d\" was changed:\n",
                   $ad_group_changes->get_adGroupId();
            printf "\t\tAd group changed status: %s\n",
                   $ad_group_changes->get_adGroupChangeStatus();
            if ($ad_group_changes->get_adGroupChangeStatus() ne "NEW") {
              printf "\t\tAds changed: %s\n",
                     get_formatted_list($ad_group_changes->get_changedAds());
              printf "\t\tCriteria changed: %s\n",
                     get_formatted_list(
                        $ad_group_changes->get_changedCriteria());
              printf "\t\tCriteria deleted: %s\n",
                     get_formatted_list(
                        $ad_group_changes->get_deletedCriteria());
            }
          }
        }
      }
      print "\n";
    }
  } else {
    print "No account changes were found.\n";
  }

  return 1;
}

sub get_formatted_list ($) {
  my $list = $_[0];
  if (!$list) {
    return "{ }";
  }
  return "{ " . join(", ", @{$list}) . " }";
}

# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
  return 1;
}

# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();

# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201309"});

# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);

# Call the example
get_account_changes($client);



( run in 0.807 second using v1.01-cache-2.11-cpan-0d23b851a93 )