Callout extensions: Ad group extension and Ad group extension

386 views
Skip to first unread message

di...@algomizer.com

unread,
Jan 12, 2017, 5:18:27 AM1/12/17
to AdWords API Forum
How can I create callout extensions as Ad group extension or/and Ad group extension

I can create callout extensions in Campaign extension level according to example:

but I can't find how can it be created in Ad group extension or/and Ad group extension level

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jan 12, 2017, 1:51:46 PM1/12/17
to AdWords API Forum
Hi, 

Yes, you should be able to create 'CALLOUT' extension at AdGroup level. We dont have a sample for this specific case, but you could refer to this example which is associating 'SITELINK' to a campaign. You will need to modify the code to use AdGroupExtensionSettingServiceInterface instead. Below is a sample SOAP request log:

 <soapenv:Body>
            <operations>
                <operator>ADD</operator>
                <operand>
                    <adGroupId>***</adGroupId>
                    <extensionType>CALLOUT</extensionType>
                    <extensionSetting>
                        <extensions xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201609" xsi:type="ns2:CalloutFeedItem">
                            <ns2:calloutText>Free delivery</ns2:calloutText>
                        </extensions>
                        <extensions xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201609" xsi:type="ns3:CalloutFeedItem">
                            <ns3:calloutText>Kids eat free</ns3:calloutText>
                        </extensions>
                    </extensionSetting>
                </operand>
            </operations>
        </mutate>
    </soapenv:Body>

Thanks,
Sreelakshmi, AdWords API Team

Matthew Wawrin

unread,
Jan 12, 2017, 5:33:32 PM1/12/17
to AdWords API Forum
Hi,

You can use the AdGroupExtensionSettingService similar to how the document you reference uses the CampaignExtensionSettingService, but instead of specifying a campaignId, you specify an adGroupId.
and

I don't believe there's example code specific to adGroupExtensionSetting, but it's nearly identical to the campaign setting, but with adgroup substituted for campaign.

Hope this helps.  

di...@algomizer.com

unread,
Mar 21, 2017, 1:01:20 PM3/21/17
to AdWords API Forum
Implementation according to your answer:

public AdGroupExtensionSettingReturnValue CreateAccountCalloutExtension(long adGroupId, string calloutText)
        {
            AdGroupExtensionSetting adGroupExtensionSetting = new AdGroupExtensionSetting
            {
                adGroupId = adGroupId,
                extensionType = FeedType.CALLOUT,
                extensionSetting = new ExtensionSetting()
                {
                    extensions = new ExtensionFeedItem[]
                    {
                        new CalloutFeedItem() {calloutText = calloutText}
                    }
                }
            };


            var operation = new AdGroupExtensionSettingOperation()
            {
                operand = adGroupExtensionSetting,
                @operator = Operator.ADD
            };

            Logger.Instance.Info($"Attempting to create callout extension for AdGroup. text: {calloutText}");

            return _adGroupExtensionSettingService.mutate(new[] { operation });

di...@algomizer.com

unread,
Mar 21, 2017, 1:04:14 PM3/21/17
to AdWords API Forum
Hi, 
Can you advise how to make callout extensions can be added on account level ?


On Friday, January 13, 2017 at 12:33:32 AM UTC+2, Matthew Wawrin wrote:

Shwetha Vastrad (AdWords API Team)

unread,
Mar 21, 2017, 5:11:49 PM3/21/17
to AdWords API Forum
Hi, 

To create callout extensions at the account level, you'll need to use CustomerExtensionSettingService to add CalloutFeedItems. The code snippet provided here shows how to add a CalloutFeedItem at the Campaign level using CampaignExtensionSettingService. You'll need to modify this to add a CalloutFeedItem the Customer level instead. 

Regards,
Shwetha, AdWords API Team.

di...@algomizer.com

unread,
Mar 23, 2017, 12:33:18 PM3/23/17
to AdWords API Forum
Hi,
the problem with CustomerExtensionSettingService  that I can't find where customerId can be set ?
I need to set callout extension for specific customer and not for all ManagedCustomers under the same Manager adwords user
Can you assist ?

code spinet with using of CustomerExtensionSettingService:

CustomerExtensionSetting customerExtensionSetting = new CustomerExtensionSetting
                {
                    extensionType = FeedType.CALLOUT,
                    extensionSetting = new ExtensionSetting()
                    {
                        extensions = new ExtensionFeedItem[]
                        {
                            new CalloutFeedItem
                            {
                                calloutText = "account level callout feed",
                                feedType = FeedType.CALLOUT
                            }
                        }
                    }
                };

                CustomerExtensionSettingOperation customerOperation = new CustomerExtensionSettingOperation()
                {
                    operand = customerExtensionSetting,
                    @operator = Operator.ADD,
                };

                CustomerExtensionSettingService customerExtensionSettingService = 
                    (CustomerExtensionSettingService)AdwordsUser.GetService(AdWordsService.v201702.CampaignExtensionSettingService);

                CustomerExtensionSettingReturnValue customerExtensionSettingReturnValue = customerExtensionSettingService.mutate(new[] { customerOperation });

Shwetha Vastrad (AdWords API Team)

unread,
Mar 23, 2017, 2:24:09 PM3/23/17
to AdWords API Forum
Hi, 

You need to set the clientCustomerId in the request header to add an extension at the customer level using CustomerExtensionSettingService. You will not be setting the customerId in the CustomerExtensionSetting object. You can programmatically set the clientCustomerId at runtime by following the instructions provided here for your client library. 

di...@algomizer.com

unread,
Mar 26, 2017, 7:29:42 AM3/26/17
to AdWords API Forum
Hi,
Thank you for assistance,
this is code snippet that I wrote for adding call out extension for account:

public CustomerExtensionSettingReturnValue SetAccountCallOutExtention(string customerId, string calloutText)
        {
            CustomerExtensionSettingService customerExtensionSettingService = 
                (CustomerExtensionSettingService)AdwordsUser.GetService(AdWordsService.v201702.CustomerExtensionSettingService);
            _customerExtensionSettingService.RequestHeader.clientCustomerId = customerId;
            CustomerExtensionSetting customerExtensionSetting = new CustomerExtensionSetting
            {
                extensionType = FeedType.CALLOUT,
                extensionSetting = new ExtensionSetting()
                {
                    extensions = new ExtensionFeedItem[]
                        {
                            new CalloutFeedItem
                            {
                                calloutText = calloutText,
                                feedType = FeedType.CALLOUT
                            }
                        }
                }
            };

            CustomerExtensionSettingOperation customerOperation = new CustomerExtensionSettingOperation()
            {
                operand = customerExtensionSetting,
                @operator = Operator.ADD,
            };

            return customerExtensionSettingService.mutate(new[] { customerOperation });

Ivan Bautista

unread,
Mar 27, 2017, 2:03:10 AM3/27/17
to AdWords API Forum
Hi,

As mentioned by my colleague earlier, to include the clientCustomerId in the request header at runtime, you can programmatically set it by following the instructions (refer to the section of the language you are using) provided in this guide.

For example, if you are using C# for development, then you may set clientCustomerId programmatically using the Config property of the AdWordsUser object. Please refer to the sample code below: 

AdWordsUser user = new AdWordsUser(); 
AdWordsAppConfig config = (AdWordsAppConfig) user.Config; 
user.Config.clientCustomerId = "<CUSTOMER ID>";

Regards,
Ivan
AdWords API Team 

di...@algomizer.com

unread,
Mar 27, 2017, 6:53:15 AM3/27/17
to AdWords API Forum
Yes,
this what I did in line:
_customerExtensionSettingService.RequestHeader.clientCustomerId = customerId;

the code snippet I posted is working example that I wrote,
I posted it here as an example if some one will look for solution

radim.kl...@hotel.cz

unread,
Apr 12, 2017, 5:11:51 AM4/12/17
to AdWords API Forum
Hi,
could you help me with API error ExtensionSettingError.INCOMPATIBLE_UNDERLYING_MATCHING_FUNCTION which I get always I call the requet to create new callout in Account level.
Everything works great when I create new callout related to AdGroup od Campaign (Using CampaignExtensionSettingService or AdGroupExtensionSettingService). But if I use CustomerExtensionSettingService like this:

// Get CustomerExtensionSettingService
$extensionSettingService = $this->_getService(cm\CustomerExtensionSettingService::class); // Internal method to get service correctly

$calloutFeedItem = (new cm\CalloutFeedItem())
->setFeedType(cm\FeedType::CALLOUT)
->setCalloutText('Test Callout');

// Prepare basic data
$extensionSetting = (new cm\CustomerExtensionSetting())
// ->setCampaignId(...) // when I tried to create to AdGroup or campaign
->setExtensionType(cm\FeedType::CALLOUT)
->setExtensionSetting(new cm\ExtensionSetting([$calloutFeedItem]));


// Create operation
$operations = new cm\CustomerExtensionSettingOperation(cm\Operator::ADD, null, $extensionSetting);

// Add the callout over API to adwords
$result = $extensionSettingService->mutate([$operations]);

there si error Uncaught Google\AdsApi\AdWords\v201702\cm\ApiException: [ExtensionSettingError.INCOMPATIBLE_UNDERLYING_MATCHING_FUNCTION @ operations[0].operand].

Very straingh weird is that all this works fine in test account... But on real, production account it throw this error.

Thank you for responses

Dne neděle 26. března 2017 13:29:42 UTC+2 di...@algomizer.com napsal(a):

Shwetha Vastrad (AdWords API Team)

unread,
Apr 12, 2017, 1:23:27 PM4/12/17
to AdWords API Forum
Hi, 

Could you enable logging and provide the SOAP request and response logs for the requests where you encountered this error? Please use Reply privately to author when responding. 

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