How to set TrackingUrlTemplate using PHP?

55 views
Skip to first unread message

fp.mm...@gmail.com

unread,
Nov 13, 2018, 1:25:21 AM11/13/18
to AdWords API and Google Ads API Forum
I'm trying to set TrackingUrlTemplate and I getting the error in response. I know that you do not support JS but I'm doing it through javascript using node-adwords.
If you be so kind and give me a sample of php code how to do mutate() on CustomerService then I could figure out how to do it with JS.

I don't know what customers fields are required for mutate().
I have read almost every guide and code sample on you dev site. But can't find any example of mutate for CustomerService.

Thank you in advance! Really hope some one can help!


<soap:Envelope

xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Header>

<ResponseHeader

xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809"

xmlns="https://adwords.google.com/api/adwords/mcm/v201809">

<ns2:requestId>00057a7858a439180a8585977b036599</ns2:requestId>

<ns2:serviceName>CustomerService</ns2:serviceName>

<ns2:methodName>mutate</ns2:methodName>

<ns2:operations>1</ns2:operations>

<ns2:responseTime>162</ns2:responseTime>

</ResponseHeader>

</soap:Header>

<soap:Body>

<soap:Fault>

<faultcode>soap:Server</faultcode>

<faultstring>[RequiredError.REQUIRED @ customer]</faultstring>

<detail>

<ApiExceptionFault

xmlns="https://adwords.google.com/api/adwords/mcm/v201809"

xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809">

<ns2:message>[RequiredError.REQUIRED @ customer]</ns2:message>

<ns2:ApplicationException.Type>ApiException</ns2:ApplicationException.Type>

<ns2:errors

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:RequiredError">

<ns2:fieldPath>customer</ns2:fieldPath>

<ns2:fieldPathElements>

<ns2:field>customer</ns2:field>

</ns2:fieldPathElements>

<ns2:trigger></ns2:trigger>

<ns2:errorString>RequiredError.REQUIRED</ns2:errorString>

<ns2:ApiError.Type>RequiredError</ns2:ApiError.Type>

<ns2:reason>REQUIRED</ns2:reason>

</ns2:errors>

</ApiExceptionFault>

</detail>

</soap:Fault>

</soap:Body>

</soap:Envelope>



Peter Oliquino (AdWords API Team)

unread,
Nov 13, 2018, 2:32:31 AM11/13/18
to AdWords API and Google Ads API Forum
Hi,

Apologies as we currently do not have a PHP example code for what you wish to achieve. However, you may refer below for the sample SOAP request and response structure on how to update your Customer's trackingUrlTemplate field :

<?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/mcm/v201809" soapenv:mustUnderstand="0">
            <ns2:clientCustomerId xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809">YOUR_CLIENT_CUSTOMER_ID</ns2:clientCustomerId>
            <ns3:developerToken xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201809">REDACTED</ns3:developerToken>
            <ns4:userAgent xmlns:ns4="https://adwords.google.com/api/adwords/cm/v201809">YOUR_USER_AGENT</ns4:userAgent>
            <ns5:validateOnly xmlns:ns5="https://adwords.google.com/api/adwords/cm/v201809">false</ns5:validateOnly>
            <ns6:partialFailure xmlns:ns6="https://adwords.google.com/api/adwords/cm/v201809">false</ns6:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
        <mutate xmlns="https://adwords.google.com/api/adwords/mcm/v201809">
            <customer>
                <trackingUrlTemplate>http://tracker.example.com/?season={_season}&amp;promocode={_promocode}&amp;u={lpurl}"</trackingUrlTemplate>
            </customer>
        </mutate>
    </soapenv:Body>
</soapenv:Envelope>
[13 Nov 2018 15:22:12,562-soapXmlLogger:DEBUG:main] 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/mcm/v201809" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809">
            <ns2:requestId>00057a86ad1d01d80abc8e8bc500bc2b</ns2:requestId>

            <ns2:serviceName>CustomerService</ns2:serviceName>
            <ns2:methodName>mutate</ns2:methodName>
            <ns2:operations>1</ns2:operations>
            <ns2:responseTime>304</ns2:responseTime>

        </ResponseHeader>
    </soap:Header>
    <soap:Body>
        <mutateResponse xmlns="https://adwords.google.com/api/adwords/mcm/v201809" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809">
            <rval>
                <customerId>YOUR_CLIENT_CUSTOMER_ID</customerId>
                <currencyCode>PHP</currencyCode>
                <dateTimeZone>Asia/Manila</dateTimeZone>
                <descriptiveName>testacctone</descriptiveName>
                <canManageClients>false</canManageClients>
                <testAccount>true</testAccount>
                <autoTaggingEnabled>false</autoTaggingEnabled>
                <trackingUrlTemplate>http://tracker.example.com/?season={_season}&amp;promocode={_promocode}&amp;u={lpurl}"</trackingUrlTemplate>
                <parallelTrackingEnabled>false</parallelTrackingEnabled>
                <conversionTrackingSettings>
                    <effectiveConversionTrackingId>YOUR_CONVERSION_TRACKING_ID_NO_NEED_TO_SPECIFY_IN_THE_REQUEST</effectiveConversionTrackingId>
                    <usesCrossAccountConversionTracking>false</usesCrossAccountConversionTracking>
                </conversionTrackingSettings>
                <remarketingSettings>
                    <snippet>SNIPPET_VALUE_NO_NEED_TO_SPECIFY_IN_THE_REQUEST</snippet>
                    <googleGlobalSiteTag>TAG_VALUE_NO_NEED_TO_SPECIFY_IN_THE_REQUEST</googleGlobalSiteTag>
                </remarketingSettings>
            </rval>
        </mutateResponse>
    </soap:Body>
</soap:Envelope>

I hope this helps.

Thanks and regards,
Peter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages