Add Experiment & set Bid Multiplier for Max. CPC

108 views
Skip to first unread message

Sany Ahmed

unread,
May 29, 2015, 11:55:50 PM5/29/15
to adwor...@googlegroups.com

Hi Josh,

As you told me to make new post. this is it.

When i downloaded keyword report two keyword with (same id + same keyword_text) are withing same adgroup  but different adnetworktype2. then the problem is when i am trying to set Max CPC for individual keywords with different values , i am in a fix how to select my individual keywords . i have attached a png here with field names

Please help me out as you help me previously.i am looking for you helpful suggestion. Thanks in advance.

Or advice/provide some example code to add keyword Max. CPC bid for experiment.

KEYWORD FIND
=============
 //Find keyword to set experimental Max CPC
 $keyword = new Keyword($value['keyword_text'], $value['keyword_match_type'], $value['id']);  // here no way to specify ad network type2 like google search or search partner


TOTAL CODE
==========

function AddExperimentAndSetBidMultiplier(AdWordsUser $user, $campaignId, $adGroupId) {
   
 // Get the services, which loads the required classes.
    $experimentService = $user->GetService('ExperimentService', ADWORDS_VERSION);
    $adGroupService = $user->GetService('AdGroupService', ADWORDS_VERSION);
    $adGroupCriterionService = $user->GetService('AdGroupCriterionService', ADWORDS_VERSION);

    // Create experiment.
    $experiment = new Experiment();
    $experiment->campaignId = $campaignId;
    $experiment->name = 'experiment bid mulitplier for individual keyword;
    $experiment->queryPercentage = 50;

    // Set additional settings (optional).
    $experiment->startDateTime = date('Ymd His', strtotime('+1 day'));
    $experiment->endDateTime = date('Ymd His', strtotime('+1 month'));

    // Create operation.
    $experimentOperation = new ExperimentOperation();
    $experimentOperation->operand = $experiment;
    $experimentOperation->operator = 'ADD';

    $experimentOperations = array($experimentOperation);

    // Make the mutate request.
    $result = $experimentService->mutate($experimentOperations);

    // Display result.
    $experiment = $result->value[0];
    printf ("Experiment with name '%s' and ID '%.0f' was added.\n", $experiment->name, $experiment->id);


        // Create ad group bid multipliers to be used in the experiment.
            $adGroupBidMultipliers = new ManualCPCAdGroupCriterionExperimentBidMultiplier();
            $adGroupBidMultipliers->maxCpcMultiplier = new BidMultiplier($value['experiment_bid_multiplier']); //values from my database


        // Create experiment data for a new experiment-only keyword.
            $adGroupCriterionExperimentData =new BiddableAdGroupCriterionExperimentData();
            $adGroupCriterionExperimentData->experimentId =  $experiment->id;                 //experiment i have created on my campaign now

            $adGroupCriterionExperimentData->experimentDeltaStatus = 'MODIFIED';
            $adGroupCriterionExperimentData->experimentBidMultiplier=$adGroupBidMultipliers;

        //Find KEYWORD to SET Max. CPC
            $keyword = new Keyword($value['keyword_text'], $value['keyword_match_type'], $value['id']);  //values from my database to find keyword


        // Create ad group criterion.
            $adGroupCriterion = new BiddableAdGroupCriterion();
            $adGroupCriterion->adGroupId = $value['adgroup_id'];   //values from my database

            $adGroupCriterion->criterion = $keyword;

            $adGroupCriterion->experimentData = $adGroupCriterionExperimentData;


        // Create operation.
            $adGroupCriterionOperation = new AdGroupCriterionOperation();
            $adGroupCriterionOperation->operand = $adGroupCriterion;
            $adGroupCriterionOperation->operator = 'ADD';                     //Here i need to SET or ADD operator at the time of adding experimental Max CPC?


            $adGroupCriterionOperations = array($adGroupCriterionOperation);

        // Make the mutate request.
            $result = $adGroupCriterionService->mutate($adGroupCriterionOperations);

        // Display result.
           $adGroup = $result->value[0];
           printf ("Ad group with name '%s' and ID '%.0f' was updated in the ".experiment.\n", $adGroup->name, $adGroup->id);

}

Thanks,

Sany
problem2.png

Nadine Sundquist (AdWords API Team)

unread,
Jun 1, 2015, 2:17:52 PM6/1/15
to adwor...@googlegroups.com, san...@gmail.com
Hi Sany,

It sounds like you're trying to solve two problems. I've broken down the answer into parts.

Part 1: Find the keyword by adnetworktype2.

Information regarding targeting based on Google Search or Search partners is based on the NetworkSetting in the Campaign. If you want to set that field, it would be through the CampaignService. I don't know of a simple way of retrieving keywords by adnetworktype2 (also known in the API as networkSetting). You would need to get the campaigns associated with the AdGroupCriterion in order to get the value of networkSetting.  

Part 2: Set the max CPC bid for a keyword.

When setting information on your AdGroupCriterion, you will also want to set a CpcBid. Setting the bid on the CpcBid will adjust the maximum CPC bid. Check out the PHP example on Adding Keywords where we show how to create a BiddingStrategyConfiguration that contains the CpcBid.  

Cheers,
Nadine, AdWords API Team

Sarah Riddell

unread,
Jun 4, 2015, 1:52:29 AM6/4/15
to adwor...@googlegroups.com, san...@gmail.com
Hi Nadine,

Many Thanks for your reply , i have fixed above problems, can you please help out on below problem?.

  1. How can i START Experiment on campaigns ?
  2. How can i PAUSE or UNPAUSE Experiment on campaigns ?
Can you provide some example code for this?.

AS i am successfully able to ADD & REMOVE experiments on campaigns

Thanks,

Sany

Nadine Sundquist (AdWords API Team)

unread,
Jun 4, 2015, 9:50:39 AM6/4/15
to adwor...@googlegroups.com, sarahri...@gmail.com, san...@gmail.com
Hello Sany,

Could you please start a new thread with this question? I don't want to overload this thread with too many topics.

Thanks,
Nadine, AdWords API Team
Reply all
Reply to author
Forward
0 new messages