How do you bid adjust in a placement with mobile application type?

34 views
Skip to first unread message

ken...@blvnp.com

unread,
Dec 13, 2017, 3:37:00 AM12/13/17
to AdWords API Forum
I already have a workign Placement bid adjustment using ad group id and final urls, it works fine.


Follow up question: How do you bid adjust a placement using criterion id?


Thanks!

Vincent Racaza (AdWords API Team)

unread,
Dec 13, 2017, 5:10:40 AM12/13/17
to AdWords API Forum
Hi,

Can you confirm if what you meant by the "bid adjust a placement" is setting the bidModifier field of a BiddableAdGroupCriterion? If so, then you can refer to this guide on how to do this. From the example, you just need to change the criterion being used from Platform to Placement as well as the operator to SET instead of ADD.

Let me know if what you meant is this. If not, then kindly provide more details on the goal that you want to achieve so I can further check.

Thanks,
Vincent
AdWords API Team

ken...@blvnp.com

unread,
Dec 13, 2017, 5:47:48 AM12/13/17
to AdWords API Forum
@Vincent What I mean by "bid adjust a placement" is that I want to adjust the bid (like for example) %10 of a placement with type mobile application. This placement with type Mobile Application has a criterion ID.

As for the reference you give me, I don't think that guide would work just by replacing the Platform class. 

Vincent Racaza (AdWords API Team)

unread,
Dec 13, 2017, 6:14:39 AM12/13/17
to AdWords API Forum
Hi,

My apologies as I was not able to check that the AdGroupBidModifierService is for Platform and PreferredContent criteria only. So you can update the bidModifier for the placement criterion, you can use the AdGroupCriterionService.mutate() with SET operator. However, aside from the id of the placement criterion, you also need to set the adGroupId in your request. Below is a sample SOAP request snippet that you can emulate:

<soapenv:Body>
       
<mutate xmlns="https://adwords.google.com/api/adwords/cm/v201710">
           
<operations>
               
<operator>SET</operator>
               
<operand xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201710" xsi:type="ns2:BiddableAdGroupCriterion">
                   
<ns2:adGroupId>XXXXXXXXXXXXXX</ns2:adGroupId>
                   
<ns2:criterion xsi:type="ns2:Placement">
                       
<ns2:id>XXXXXXXXXXXXXX</ns2:id>
                   
</ns2:criterion>
                   
<ns2:bidModifier>2.4</ns2:bidModifier>
               
</operand>
           
</operations>
       
</mutate>
</soapenv:Body>

Let me know if this helps.

ken...@blvnp.com

unread,
Dec 13, 2017, 6:54:52 AM12/13/17
to AdWords API Forum
Im really sorry. Im not good with SOAP. Can you provide me a PHP?


I have this code with adjusting bid for placement using ad group id and url.


    $adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class);

    $placement = new Placement();
    $placement->setUrl($url);

    if($exclude == 'false'){
      $adGroupCriterion = new NegativeAdGroupCriterion();
    }else{
      $adGroupCriterion = new BiddableAdGroupCriterion();
      $adGroupCriterion->setBidModifier($bid_adjustment);
    }

    $adGroupCriterion->setAdGroupId($adGroupId);
    $adGroupCriterion->setCriterion($placement);

    $adGroupCriterionOperation = new AdGroupCriterionOperation();
    $adGroupCriterionOperation->setOperand($adGroupCriterion);

    switch ($operator) {
      case 'add':
        $adGroupCriterionOperation->setOperator(Operator::ADD);
      break;
      case 'set':
        $adGroupCriterionOperation->setOperator(Operator::SET);
      break;
      case 'remove':
        $adGroupCriterionOperation->setOperator(Operator::REMOVE);
      break;
      default:
        // default is add
        $adGroupCriterionOperation->setOperator(Operator::ADD);
      break;
    }


    $operations[] = $adGroupCriterionOperation;

    try {
      $results = $adGroupCriterionService->mutate($operations);
    } catch (Exception $e) {
        return array(
          "status"  => "fail",
          "message" => 'Caught exception: '.  $e->getMessage()
        );
    }

On Wednesday, December 13, 2017 at 4:37:00 PM UTC+8, ken...@blvnp.com wrote:

ken...@blvnp.com

unread,
Dec 13, 2017, 6:54:13 PM12/13/17
to AdWords API Forum
Hi, can you teach me how to do it in PHP?


On Wednesday, December 13, 2017 at 4:37:00 PM UTC+8, ken...@blvnp.com wrote:

Vincent Racaza (AdWords API Team)

unread,
Dec 13, 2017, 11:01:23 PM12/13/17
to AdWords API Forum
Hi,

Please refer to the PHP sample code below that should update the bidModifier of your placement criterion:

  $adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class);

  $operations 
= [];
  $bid = 1.7;

  $placement 
= new Placement();
  $placement
->setId(XXXXXXXXXX);
  $biddableAdGroupCriterion 
= new BiddableAdGroupCriterion();
  $biddableAdGroupCriterion
->setAdGroupId(XXXXXXXXXXX);
  $biddableAdGroupCriterion
->setCriterion($placement);
  $biddableAdGroupCriterion
->setBidModifier($bid);

  $adGroupCriterionOperation 
= new AdGroupCriterionOperation();
  $adGroupCriterionOperation
->setOperand($biddableAdGroupCriterion);
  $adGroupCriterionOperation
->setOperator(Operator::SET);
  $operations
[] = $adGroupCriterionOperation;   
 
  $result 
= $adGroupCriterionService->mutate($operations);

Hope this helps.

ken...@blvnp.com

unread,
Dec 13, 2017, 11:20:45 PM12/13/17
to AdWords API Forum
Placement class doesn't have setId method.





<?php

namespace Google\AdsApi\AdWords\v201708\cm;


/**
 * This file was generated from WSDL. DO NOT EDIT.
 */
class Placement extends \Google\AdsApi\AdWords\v201708\cm\Criterion
{

    /**
     * @var string $url
     */
    protected $url = null;

    /**
     * @param int $id
     * @param string $type
     * @param string $CriterionType
     * @param string $url
     */
    public function __construct($id = null, $type = null, $CriterionType = null, $url = null)
    {
      parent::__construct($id, $type, $CriterionType);
      $this->url = $url;
    }

    /**
     * @return string
     */
    public function getUrl()
    {
      return $this->url;
    }

    /**
     * @param string $url
     * @return \Google\AdsApi\AdWords\v201708\cm\Placement
     */
    public function setUrl($url)
    {
      $this->url = $url;
      return $this;
    }

}




On Wednesday, December 13, 2017 at 4:37:00 PM UTC+8, ken...@blvnp.com wrote:

Vincent Racaza (AdWords API Team)

unread,
Dec 14, 2017, 12:32:08 AM12/14/17
to AdWords API Forum
Hi,

The id of placement criterion can be set. According to the link, "This field is required and should not be null when it is contained within Operators : SET, REMOVE". Since Placement object is a subclass of Criterion object, then it inherited the id of the Criterion on which you can use as id in the Placement object itself.

Also, I have already tested this code on my end and it worked successfully. Please try it on your end and see if there are any issues that you'll encounter.

ken...@blvnp.com

unread,
Dec 14, 2017, 1:44:34 AM12/14/17
to AdWords API Forum
Holy shit.. It really worked! Thank you!


On Wednesday, December 13, 2017 at 4:37:00 PM UTC+8, ken...@blvnp.com wrote:
Reply all
Reply to author
Forward
0 new messages