Add ad - This doesn't meet editorial guidelines

658 views
Skip to first unread message

Coenie Richards

unread,
Oct 15, 2019, 4:25:28 AM10/15/19
to Google Ads Scripts Forum
Hi All

The script below creates the following log.

Campaign found
New Ad data loaded
Ad group was found
Keywords created.
Going to create ad now....
Failed to create Ad (style_1) with error :POLICY_ERROR : AdPolicyError.POLICY_ERROR : ad.headlinePart1,POLICY_ERROR : AdPolicyError.POLICY_ERROR : ad.headlinePart1

When capture the same details using the GUI on ads.google.com it works. So the automated script fails using the words "Bank Repossessed Mercedes Benz" in .withHeadlinePart1 (line 135 in the script below) if I replace Mercedes Benz with Nissan the error moves to description 1, why is the Mercedes Benz causing this and why does it work on user interface manual ad creation screen.

The script
function main() {


 
var campaign = getCampaign();
 
if (!campaign){
   
Logger.log('Campaign not found...stoping script');  
   
return;
 
}
 
 
Logger.log('Campaign found');  


 
var data_for_new_ad = getNewAdData();


 
Logger.log('New Ad data loaded');  
 
  adGroup
= createAdGroup(data_for_new_ad.ad_group_name,campaign);


 
if (adGroup){


   
Logger.log('Ad group was found');  


   
if (createKeyWords(data_for_new_ad.keywords,adGroup)){


     
Logger.log('Keywords created.');  


      data_for_new_ad
.text_ads.forEach(
       
function(obj_ad){
         
Logger.log('Going to create ad now....');  
          createAd
(obj_ad, adGroup);
       
}
     
);            
   
} else {
     
Logger.log('Keywords failed to create.');  
   
}
 
} else {
   
Logger.log('Ad group was not found or could not be created');  
 
}
 
}




function getCampaign(){
 
var list = AdsApp.campaigns().withCondition('Name CONTAINS "(SEARCH AUTOMATED)"').get();
 
while(list.hasNext()){
   
return list.next();
 
}
 
return null;
}




function getNewAdData(){
 
 
return  {
   
"stock_no": "MC1908200030",
   
"ad_group_name": "MC1908200030 - MERCEDES BENZ A CLASS",
   
"text_ads": [
                 
{
                   
"head_line1": "Bank Repossessed Mercedes Benz",
                   
"head_line2": "Online Auction",
                   
"url_part_1": "mercedes_benz",
                   
"url_part_2": "a_class",
                   
"description_1": "Bank Repossessed 2015 Mercedes Benz A Class In Online Auction",
                   
"description_2": "Bids starts at R213,000",
                   
"final_url": "https://www.mycars.co.za/MC1908200030",
                   
"ad_style": "style_1"
                 
}
               
],
   
"keywords": [
                 
"mercedes benz a class",
                 
"mercedes benz a class auctions",
                 
"mercedes benz auctions",
                 
"mercedes benz a class a200 be a/t",
                 
"bank repossessed mercedes benz a class",
                 
"online auction mercedes benz a class"
                 
],
   
};
 
}


function createAdGroup(name,campaign){
 
var adGroup = getAdGroup(name);


 
if (adGroup){
    adGroup
.enable();
   
return adGroup;
 
} else {
   
var adGroupOperation = campaign.newAdGroupBuilder()
           
.withName(name)
           
.build();          
   
   
if (adGroupOperation.isSuccessful()){
      adGroup
= adGroupOperation.getResult();
     
return adGroup;
   
} else {
     
Logger.log(' Failed to create group with error :'+adGroupOperation.getErrors());  
   
}
   
 
}
 
}




function getAdGroup(name){
 
var list = AdsApp.adGroups().withCondition('Name = "'+name+'"').get();
 
while(list.hasNext()){
   
return list.next();
 
}
 
return null;
}


function createKeyWords(keywords, adGroup){
 
 
var keywordBuilder = adGroup.newKeywordBuilder();
         
  keywords
.forEach(
   
function(keyword_text){
      keywordBuilder
= keywordBuilder.withText(keyword_text);
   
}
 
);


 
var keywordOperation = keywordBuilder.build();


 
if (keywordOperation.isSuccessful()){
   
return true;
 
} else {
   
Logger.log(' Failed to create keywords for ad group with error :'+keywordOperation.getErrors());  
   
return false;
 
}  
 
}






function createAd(obj,adGroup){
 
var adOperation = adGroup.newAd().expandedTextAdBuilder()
         
.withHeadlinePart1(obj.head_line1)
         
.withHeadlinePart2(obj.head_line2)
         
.withDescription1(obj.description_1)
         
.withDescription2(obj.description_2)
         
.withPath1(obj.url_part_1)
         
.withPath2(obj.url_part_2)
         
.withFinalUrl(obj.final_url)
         
.build();


 
if (adOperation.isSuccessful()){
   
Logger.log(' Created Ad ('+obj.ad_style+')!');  
 
} else {
   
Logger.log(' Failed to create Ad ('+obj.ad_style+') with error :'+adOperation.getErrors());  


 
}  
 
}

Google Ads Scripts Forum Advisor

unread,
Oct 15, 2019, 6:48:59 AM10/15/19
to adwords...@googlegroups.com
Hi Coenie,

Thanks for posting your concern.

With regard to your issue, the Google Ads UI and the Google Ads scripts follows the same standards and policies in terms of creating ads. The different is that you can create a specific ad in the interface and the status of this will be 'under review' and will eventually disapprove when some policies are violated; however this will not be served. On the Google Ads scripts, the backend system will review the ad immediately upon executing the script and if this ad violates some policies, you will encounter the said error.

With this explanation, could you confirm if the ad is successfully created and the result is 'approved'? If yes, could you provide the customer ID and the name of the script so that I can further investigate? You can provide the requested information via Reply privately to author option. Also, please provide the ID of the created ad.

Regards,
Ejay
Google Ads Scripts Team

ref:_00D1U1174p._5001UKNIsn:ref

Coenie Richards

unread,
Oct 28, 2019, 4:11:58 AM10/28/19
to Google Ads Scripts Forum
Hi

Do you have any feedback for me regarding this ?

Google Ads Scripts Forum Advisor

unread,
Oct 28, 2019, 4:36:57 AM10/28/19
to adwords...@googlegroups.com
Hi Coenie,

My apologies for the delayed response.

Our team is currently looking into the issue. I will update you on this thread as soon as I receive information from our team.

Regards,
Ejay
Google Ads Scripts Team

ref:_00D1U1174p._5001UKNIsn:ref

Coenie Richards

unread,
Oct 28, 2019, 4:39:44 AM10/28/19
to Google Ads Scripts Forum on behalf of adsscriptsforumadvisor
Hi Ejay

Thank you for the update.

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to a topic in the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/ZApJtCajUs4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/gYJtU000000000000000000000000000000000000000000000Q02T9D00p0-qZEDVQ9-8R7Bkwa3ahg%40sfdc.net.


--
Regards
Coenie
Reply all
Reply to author
Forward
0 new messages