Hello Team,

I want to set different bidModifier for different time slot e.g Time: 11-12 
bidModifier=1.5, Time: 14-15 bidModifier=1.3.

To achieve this I used this code:

public function update_hour_bid(AdWordsUser $user,$clientId = 
null,$data=null){
        $newBid = explode("&", $data['newBid']);
        $user = new AdwordsUser();
        $user->SetClientCustomerId($clientId); // ClientId
        
        $campaignCriterionService = 
$user->GetService('CampaignCriterionService', ADWORDS_VERSION);
        
        $operations = array();
        $campaignID = $data['campaignid'];
        
        //$days = 
array('MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY','SUNDAY');
                
        foreach($newBid as $bid){
            if(!empty($bid)){
            //foreach($days as $day) {
                $Biddata = explode("=", $bid);
                //$Biddata[0] // day
                //$Biddata[1] // hour
                //$Biddata[2] // bid
                $hour = explode('-',$Biddata[1]);
                // $hour[0] // start hour
                // $hour[1] // end hour
                                
                //Set Variables
                $adSchedule = new AdSchedule();
                $adSchedule->dayOfWeek = trim($Biddata[0]);
                $adSchedule->startHour = trim($hour[0]);
                $adSchedule->startMinute = 'ZERO';
                $adSchedule->endHour = trim($hour[1]);
                $adSchedule->endMinute = 'ZERO';
                                                               
                
                //$adSchedule->bidModifier = trim($Biddata[2]);
                                
                $adScheduleCriterion = new 
CampaignCriterion();//AdScheduleCriterion();
                $adScheduleCriterion->campaignId = $campaignID;
                $adScheduleCriterion->bidModifier = trim($Biddata[2]);
                $adScheduleCriterion->criterion = $adSchedule;
                               
                //Create the Operation
                $operation = new CampaignCriterionOperation();
                $operation->operand = $adScheduleCriterion;
                $operation->operator = 'ADD';
                $operations[] = $operation;
                                
                //echo '<pre>';print_r($operations);die();
            }
        }
        //Mutate!
        $result = $campaignCriterionService->mutate($operations);
        echo '<pre>';print_r($result);die();
        if (count($results->value)){
            return 1;
        }else{
            return 0;
        }

    }

 When I use $operation->operator = 'ADD' this code generate 

<b>Fatal error</b>:  Uncaught SoapFault exception: [soap:Server] 
[CriterionError.AD_SCHEDULE_TIME_INTERVALS_OVERLAP
 @ operations[0].operand.criterion; trigger:'Existing schedule: 
AdSchedule{id=CriterionId{id=320824}
, dayOfWeek=WEDNESDAY, startHour=2, startMinute=ZERO, endHour=6, 
endMinute=ZERO}', RangeError.TOO_LOW
 @ operations[0].operand.bidModifier,

 When I use $operation->operator = 'SET' this generate error that criteria 
Id is required.


Kindly suggest me any change in this code so that I can set different  
bidModifier for different time slot.


Thanks & Regards

Sachin Kumar



-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
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 [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/1c0813a4-d4f6-4e13-aaf0-4e75cbe1026f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to