How To Update Keyword Condition Using Google Adwords Api ?

You tin respite whatever active keyword or vice versa using Google Adwords API PHP Client Library. Using next method, y'all tin Enable a 'PAUSED' keyword as well as Paused a 'ACTIVE' keyword. You tin delete the keyword every mo well.

Three states of keywords are:
ACTIVE : Default land of a standard (e.g. non paused).
DELETED : Criterion is deleted.
PAUSED : Criterion is paused. Also used to respite a criterion.

Following component subdivision tin live on used to update the keyword condition from 'PAUSED' to 'ACTIVE' as well as 'ACTIVE' to 'PAUSED'.

The primal matter is to update the userStatus field.

NOTE: During an ADD as well as SET operation: It may non live on prepare to DELETED.
 /**  * Runs the example.  * @param AdWordsUser $user the user to run the event amongst  * @param string $adGroupId the id of the advertizement grouping that contains the keyword  * @param string $criterionId the id of the keyword  * @param string $status the condition of the keyword  */ component subdivision UpdateKeyword($user, $adGroupId, $criterionId, $status){    // Get the service, which loads the required classes.   $adGroupCriterionService =       $user->GetService('AdGroupCriterionService', ADWORDS_VERSION);       // Create standard using an existing ID. Use the base of operations degree Criterion   // instead of Keyword to avoid having to prepare keyword-specific fields.   $criterion = novel Criterion();   $criterion->id = $criterionId;    // Create advertizement grouping criterion.   $adGroupCriterion = novel BiddableAdGroupCriterion();   $adGroupCriterion->adGroupId = $adGroupId;   $adGroupCriterion->criterion = novel Criterion($criterionId);       $adGroupCriterion->userStatus = $status;        // Create operation.   $operation = novel AdGroupCriterionOperation();   $operation->operand = $adGroupCriterion;   $operation->operator = 'SET';    $operations = array($operation);    // Make the mutate request.   $result = $adGroupCriterionService->mutate($operations);    // Display result.   $adGroupCriterion = $result->value[0];   furnish $adGroupCriterion;  }  

If y'all desire to delete the keyword utilization next function. You must utilization 'REMOVE' operator to delete keyword.
 /**  * Runs the example.  * @param AdWordsUser $user the user to run the event amongst  * @param string $adGroupId the id of the advertizement grouping that the keyword is inward  * @param string $criterionId the id of the keyword to delete  */ component subdivision DeleteKeyword($user, $adGroupId, $criterionId) {   // Get the service, which loads the required classes.   $adGroupCriterionService =       $user->GetService('AdGroupCriterionService', ADWORDS_VERSION);    // Create standard using an existing ID. Use the base of operations degree Criterion   // instead of Keyword to avoid having to prepare keyword-specific fields.   $criterion = novel Criterion();   $criterion->id = $criterionId;    // Create advertizement grouping criterion.   $adGroupCriterion = novel AdGroupCriterion();   $adGroupCriterion->adGroupId = $adGroupId;   $adGroupCriterion->criterion = novel Criterion($criterionId);    // Create operation.   $operation = novel AdGroupCriterionOperation();   $operation->operand = $adGroupCriterion;   $operation->operator = 'REMOVE';    $operations = array($operation);    // Make the mutate request.   $result = $adGroupCriterionService->mutate($operations);    // Display result.   $adGroupCriterion = $result->value[0];   printf("Keyword amongst ID '%s' was deleted.\n",       $adGroupCriterion->criterion->id); }  
Reference: Google Adwords API PHP
Sumber http://developer-paradize.blogspot.com

Comments

Popular posts from this blog

What Are The Main Components of a Computer System

Top Qualities To Look For In An IT Support Team

How To Integrate Google Adwords Api Into Codeigniter?