Hello. I have problem with php remarketing.

I'm using this 
and modify its. This script generate TAG and return and this is work fine, 
but how I can add this remarketing to capaing?

My code view like this:

   $campaignService = $user->GetService('CampaignService', ADWORDS_VERSION);
           $adGroupId = $group_id;

            $operations = array();
           $campaign = new Campaign();
           $campaign->id = $google_data['google_id'];

            $campaign->advertisingChannelType = 'DISPLAY';

            $networkSetting = new NetworkSetting();
           $networkSetting->targetGoogleSearch = false;
           $networkSetting->targetSearchNetwork = false;
           $networkSetting->targetContentNetwork = true;
           $campaign->networkSetting = $networkSetting;

            $operation = new CampaignOperation();
           $operation->operand = $campaign;
           $operation->operator = 'SET';
           $operations[] = $operation;

            $result = $campaignService->mutate($operations);

            $return_array['id'] = $result->value[0]->id;

 $userListService = $user->GetService('AdwordsUserListService', 

  $conversionTrackerService =
     $user->GetService('ConversionTrackerService', ADWORDS_VERSION);
 $conversionType = new UserListConversionType();
 $conversionType->name = $name . uniqid();

  $userList = new BasicUserList();
 $userList->name = $name . uniqid();
 $userList->conversionTypes = array($conversionType);
 $userList->status = 'OPEN';
 $userList->membershipLifeSpan = $day;

  $operation = new UserListOperation();
 $operation->operand = $userList;
 $operation->operator = 'ADD';
 $operations = array($operation);
 $result = $userListService->mutate($operations);
 $userList = $result->value[0];
 $static_user_id = $userList->id;
// print_r($userList->id);
// exit;

 $selector = new Selector();
 $selector->fields = array('Id');
 $selector->predicates[] =
     new Predicate('Id', 'IN', array($userList->conversionTypes[0]->id));

  $page = $conversionTrackerService->get($selector);

  $conversionTracker = $page->entries[0];
$tag = $conversionTracker->snippet;

$audience_id = $userList->conversionTypes[0]->id;

            $campaignId = $return_array['id'];
           $adGroupService = $user->GetService('AdGroupService', 

            $operations = array();
           $adGroup = new AdGroup();
           $adGroup->id = $google_data['google_group_id'];
           $adGroup->campaignId = $campaignId;

            $targetingSetting = new TargetingSetting();
           $targetingSetting->details[] = new TargetingSettingDetail(
'PLACEMENT', false);
           $adGroup->settings[] = $targetingSetting;

            $operation = new AdGroupOperation();
           $operation->operand = $adGroup;
           $operation->operator = 'SET';
           $operations[] = $operation;

            $result = $adGroupService->mutate($operations);
           $return_array['id_group'] = $result->value[0]->id;

            $adGroupId = $return_array['id_group'];

            $adGroupCriterionService = $user->GetService(
'AdGroupCriterionService', ADWORDS_VERSION);

            $criterionUserList = new CriterionUserList();
           $criterionUserList->id = $static_user_id;
           $criterionUserList->type = "USER_LIST";

            $operations = array();
           $adGroupCriterion = new BiddableAdGroupCriterion();
           $adGroupCriterion->adGroupId = $adGroupId;
           $adGroupCriterion->criterion = $criterionUserList;
           $adGroupCriteria[] = $adGroupCriterion;

            $operation = new AdGroupCriterionOperation();
           $operation->operand = $adGroupCriterion;
           $operation->operator = 'SET';
           $operations[] = $operation;

            $result = $adGroupCriterionService->mutate($operations);

            $return_array['remarketing_email'] = $result->value[0]->

Do you have any idea how I can add audiences to campaign when audiences = 
website visitors?

Also find us on our blog and Google+:

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group at
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.
  • Add audiences r... testapidilren2
    • Re: Add au... 'Shwetha Vastrad (AdWords API Team)' via AdWords API Forum
      • Re: Ad... testapidilren2
        • Re... testapidilren2
          • ... 'Shwetha Vastrad (AdWords API Team)' via AdWords API Forum

Reply via email to