ad.getHeadlinePart1() returns {ph_0} instead of {=Year.next}

495 views
Skip to first unread message

admigo

unread,
Nov 26, 2016, 9:20:48 PM11/26/16
to AdWords Scripts Forum
Hi,

I have written a script which checks if all ad groups with use customizers have got at least one ad without customizers.
My script is looking for "{=" in ad.getHeadline()+ad.getDescription1()+ad.getDescription2() or ad.getHeadlinePart1()+ad.getHeadlinePart2()+ad.getDescription().
But it doesn't work for the new expanded ads:-(

I have two ads in an ad group. One standard ad and a new expanded ad.
Both have got the (first) headline: "text {=Year.next}"

Standard ad: ad.getHeadline() => "text {=Year.next}"
Expanded ad: ad.getHeadlinePart1() => "text {ph_0}"

Is {ph_0} a bug or a feature?:-)

Thanks
          Holger

Martin Roettgerding

unread,
Nov 27, 2016, 8:32:26 PM11/27/16
to AdWords Scripts Forum
Hi Holger,

I had they same problem. The workaround I used was to go through the ad performance report instead of using the ad object.

Anash Oommen

unread,
Nov 28, 2016, 11:03:19 AM11/28/16
to AdWords Scripts Forum
Hi Martin, Holger,

Thank you for bringing this issue to our attention. I've asked the team to update the behaviour to match that of the old text ads. I'll update this thread once I hear from them. 

Cheers
Anash P. Oommen,
AdWords Scripts Team.

admigo

unread,
Nov 28, 2016, 11:10:02 AM11/28/16
to AdWords Scripts Forum
Thanks Anash,

I'm not a fan of workarounds:-)

      Holger

admigo

unread,
Nov 30, 2016, 8:00:17 AM11/30/16
to AdWords Scripts Forum

Hi Anash,

now I'm totaly confused:

while (adIterator.hasNext()) {
       var ad = adIterator.next();
       var sAdType = ad.getType();
           if (sAdType == "TEXT_AD") {
             Logger.log("ad.getHeadline(): "+ad.getHeadline());  // returns the text of the headline (ok)
           } else  if (sAdType == "EXPANDED_TEXT_AD") {
            Logger.log("ad.getType(): "+ad.getType()); // returns "EXPANDED_TEXT_AD"
            Logger.log("ad.isType().expandedTextAd(): "+ad.isType().expandedTextAd()); // returns true
            Logger.log("ad.getHeadlinePart1(): "+ad.getHeadlinePart1()); // returns null for all expanded ads
            Logger.log("ad.getHeadlinePart2(): "+ad.getHeadlinePart2()); // returns null for all expanded ads
            Logger.log("ad.ad.getDescription(): "+ad.getDescription()); // returns null for all expanded ads
          }
}

Ciao
        Holger

Richard Hogg

unread,
Nov 30, 2016, 4:14:07 PM11/30/16
to AdWords Scripts Forum
Don't think its working as this returns NULL too. 

function main() {
  
  var adIterator = AdWordsApp.ads().withCondition("CampaignName CONTAINS_IGNORE_CASE 'Script_Test'").get();
  
    while (adIterator.hasNext()) {
        var ad = adIterator.next();
        var sAdType = ad.getType();
      
      if (ad.getType() == "TEXT_AD") {
          
        Logger.log('Headline : ' + ad.getHeadline());
        
    } else if (ad.getType() == "EXPANDED_TEXT_AD") {
      
        var expandedTextAd = ad.asType().expandedTextAd();
        var headlinePart1 = expandedTextAd.getHeadlinePart1();
        var headlinePart2 = expandedTextAd.getHeadlinePart2();
      
        Logger.log('ETA Headline Part 1 : ' + expandedTextAd.getHeadlinePart1());
        Logger.log('ETA Headline Part 2 : ' + expandedTextAd.getHeadlinePart2());
        Logger.log('ETA Description : ' + expandedTextAd.getDescription());
        
    }
    }
}

Anash Oommen

unread,
Nov 30, 2016, 4:31:04 PM11/30/16
to AdWords Scripts Forum
Folks,

The nulls getting returned in Scripts is a known issue, due to a change in AdWords API. We are aware of the issue and working with the relevant teams. I'll keep you updated.

Cheers,

Anash P. Oommen,
AdWords Scripts Team.

Anash Oommen

unread,
Dec 1, 2016, 7:21:21 AM12/1/16
to AdWords Scripts Forum
Hi everyone,

This issue should be fixed now, let me know if you continue to see similar issues with expanded text ads.

Cheers,
Anash P. Oommen,
AdWords Scripts Team.

admigo

unread,
Dec 1, 2016, 7:45:28 AM12/1/16
to AdWords Scripts Forum
Hi Anash,

it works!

Thanks
           Holger

Martin Roettgerding

unread,
Dec 12, 2016, 6:34:54 AM12/12/16
to AdWords Scripts Forum
Hi Anash,

Even though the issue with {PH_0} is resolved for scripts, these placeholders are still used when ad disapproval mails are sent out. For example, there it says:

Ad text:

My headline 1

{PH_0}

{PH_1}

https://myURL


It's off topic, but this seemed the best place to report it. Maybe you could pass it along...


Cheers

Martin

Anash Oommen

unread,
Dec 13, 2016, 4:37:13 PM12/13/16
to AdWords Scripts Forum
Hi Martin,

Could you please share a screenshot of the email with me by using the "Reply to Author" option? There's someone looking into this already, but a screenshot of the email will help.

Tx
Anash
Message has been deleted
Message has been deleted

Google Ads Scripts Forum Advisor Prod

unread,
May 28, 2019, 7:54:05 AM5/28/19
to adwords...@googlegroups.com

Hi Mykhailo,

With regard to your concern about getHeadlinePart3 and getDescription2, upon testing in my test account, I was able to get the values for both fields successfully. With this, so I can further investigate the issue, could you provide your CID and script name via Reply privately to author?

Regards,
Hiroyuki
Google Ads Scripts Team



ref:_00D1U1174p._5001UAqoz0:ref
Reply all
Reply to author
Forward
0 new messages