How do Ad Customizers associate FeedItems with Ads?

68 views
Skip to first unread message

s...@feedonomics.com

unread,
Dec 27, 2016, 5:15:25 PM12/27/16
to AdWords API Forum
How do ads know which FeedItem to inject placeholders within the ad with? Looking at our FeedItems, I see: 

object(FeedItem)#46 (14) {
      ["feedId"]=>
      string(8) "41951232"
      ["feedItemId"]=>
      string(10) "9721062641"

as the only unique identifiers for the FeedItem. So how do the ads know which FeedItem to use for the dynamic values?

I need to know this, because I need to update associated FeedItems when we have inventory or price changes within our API script.

s...@feedonomics.com

unread,
Dec 27, 2016, 7:37:10 PM12/27/16
to AdWords API Forum
adGroupTargeting is set during creation of FeedItem, using this snippet of code:
  $adGroupTargeting = new FeedItemAdGroupTargeting();
  $adGroupTargeting
->TargetingAdGroupId = $adGroupId;
  $item
->adGroupTargeting = $adGroupTargeting;


  $campaignTargeting
= new FeedItemCampaignTargeting();
  $campaignTargeting
->TargetingCampaignId = $campaignId;
  $item
->campaignTargeting = $campaignTargeting;

But doesn't show later on:
      ["campaignTargeting"]=>
      NULL
     
["adGroupTargeting"]=>
      NULL

So we have nothing to go off of to identify FeedItems, but the extended text ads are still filling in values dynamically, and it seems like the system knows, internally, which FeedItems to associate with each ad as we can see from the AdWords Dashboard:

Joyce Lava

unread,
Dec 27, 2016, 10:45:06 PM12/27/16
to AdWords API Forum
Hi,

To get the FeedItems with the adGroupTargeting, you may use the FeedItemService.get. Please refer to this sample SOAP request and response:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201609" soapenv:mustUnderstand="0">
            <ns1:clientCustomerId>YOUR_CLIENT_CUSTOMER_ID</ns1:clientCustomerId>
            <ns1:developerToken>YOUR_DEVELOPER_TOKEN</ns1:developerToken>
            <ns1:userAgent>YOUR_USER_AGENT</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:partialFailure>false</ns1:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
        <get xmlns="https://adwords.google.com/api/adwords/cm/v201609">
            <selector>
                <fields>AttributeValues</fields> 
                <fields>FeedId</fields>
                <fields>FeedItemId</fields>
                <fields>TargetingAdGroupId</fields>
                <paging>
                    <startIndex>0</startIndex>
                    <numberResults>100</numberResults>
                </paging>
            </selector>
        </get>
    </soapenv:Body>
</soapenv:Envelope>
 
[main] INFO com.google.api.ads.adwords.lib.client.AdWordsServiceClient.soapXmlLogger - SOAP Response:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201609">
            <requestId>REQUEST_ID</requestId>
            <serviceName>FeedItemService</serviceName>
            <methodName>get</methodName>
            <operations>1</operations>
            <responseTime>149</responseTime>
        </ResponseHeader>
    </soap:Header>
    <soap:Body>
        <getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201609">
            <rval>
                <totalNumEntries>1</totalNumEntries>
                <Page.Type>FeedItemPage</Page.Type>
                <entries>
                    <feedId>FEED_ID</feedId>
                    <feedItemId>FEED_ITEM_ID</feedItemId>
                    <attributeValues>
                        <feedAttributeId>1</feedAttributeId>
                        <stringValue>Mars</stringValue>
                    </attributeValues>
                    <attributeValues>
                        <feedAttributeId>2</feedAttributeId>
                        <stringValue>$1</stringValue>
                    </attributeValues>
                    <attributeValues>
                        <feedAttributeId>3</feedAttributeId>
                        <stringValue>20160713 104100</stringValue>
                    </attributeValues>
                    <adGroupTargeting>
                        <TargetingAdGroupId>TARGETING_ADGROUP_ID</TargetingAdGroupId>
                    </adGroupTargeting>
                </entries>
            </rval>
        </getResponse>
    </soap:Body>
</soap:Envelope>

The FeedId and the FeedItemId should make it unique. That way, you should be able to get the targeted adGroupId of the feedItem. 

Best,
Joyce, AdWords API Team

s...@feedonomics.com

unread,
Dec 28, 2016, 5:30:10 PM12/28/16
to AdWords API Forum
I found it! Thanks. The data I was looking for shows after I added 'TargetingAdGroup' to the query selector: 
$selector->fields = array('FeedItemId', 'AttributeValues', 'Status', 'TargetingAdGroupId');

Joyce Lava

unread,
Dec 28, 2016, 9:52:01 PM12/28/16
to AdWords API Forum
Hi,

Glad to hear you found the fix!
Reply all
Reply to author
Forward
0 new messages