Groups
Groups

From the display automatic placements details, find placement -> add it to managed placements

77 views
Skip to first unread message

Luca DL

unread,
Jul 6, 2016, 8:49:14 AM7/6/16
to AdWords Scripts Forum
Hello, 

I'm trying to understand how is it possible to get the URL of the placements where my ads appeared. 

Then I would like to find in the whole account each placement URL that contains ".it" during YESTERDAY.
Then, for every single URLs found containing ".it" (i.e.: libero.itvanityfair.it, etc...), I would like to build ( assuming I need the Placement Builder) one ad group containing a single managed placement.

I already tried the PLACEMENT_PERFORMANCE_REPORT but I don't get any url in the report. I'm not sure if this is the right start.

If I try another way, by using the placement selector I don't get any result at all:

function main() {
   var placementSelector = AdWordsApp.display()
     .placements()
     .withCondition("PlacementUrl CONTAINS '.it'")
     .forDateRange("ALL_TIME");

 }


Any help will be appreciated, I'm not a coder, Thanks!

Tyler Sidell (AdWords Scripts Team)

unread,
Jul 6, 2016, 2:56:45 PM7/6/16
to AdWords Scripts Forum
Hi Luca,

It looks like you are missing a placement iterator, thus why you are not seeing any results.  You would need to do something with the data returned from the selector.  Can you try the following instead to see if anything gets returned:
function main() {
   
var placementSelector = AdWordsApp.display().placements().withCondition("PlacementUrl CONTAINS '.it'").forDateRange('YESTERDAY').get();
 
 
while(placementSelector.hasNext()) {
   
var placement = placementSelector.next();
   
Logger.log(placement.getAdGroup());
 
}
 
}

Also, you can use the URL Performance Report which returns the urls of placements, specifically the url field.

Thanks,
Tyler Sidell
AdWords Scripts Team

Luca DL

unread,
Jul 6, 2016, 3:06:52 PM7/6/16
to AdWords Scripts Forum
Hi Tyler, 

Thank you for your help. When I run the preview I get this in the log: (I'm searching for .ro domains because I had too many .it)

{setName=function () {...}, getName=function () {...}, addMobileApp=function () {...}, keywords=function () {...}, bidding=function () {...}, getCampaign=function () {...}, getId=function () {...}, newKeywordBuilder=function () {...}, createKeyword=function () {...}, getStatsFor=function () {...}, urls=function () {...}, isRemoved=function () {...}, isDeleted=function () {...}, enable=function () {...}, adParams=function () {...}, setMobileBidModifier=function () {...}, addPhoneNumber=function () {...}, getJson=function () {...}, addReview=function () {...}, isPaused=function () {...}, removePhoneNumber=function () {...}, createTextAd=function () {...}, removeSitelink=function () {...}, applyLabel=function () {...}, clearMobileBidModifier=function () {...}, entityType=null, display=function () {...}, removeReview=function () {...}, getEntityType=function () {...}, proxy_=function () {...}, getMobileBidModifier=function () {...}, removeMobileApp=function () {...}, pause=function () {...}, labels=function () {...}, getKeywordMaxCpc=function () {...}, negativeKeywords=function () {...}, ads=function () {...}, extensions=function () {...}, newTextAdBuilder=function () {...}, addSitelink=function () {...}, createNegativeKeyword=function () {...}, isEnabled=function () {...}, setKeywordMaxCpc=function () {...}, removeCallout=function () {...}, toString=function () {...}, removeLabel=function () {...}, addCallout=function () {...}}
{setName=function () {...}, getName=function () {...}, addMobileApp=function () {...}, keywords=function () {...}, bidding=function () {...}, getCampaign=function () {...}, getId=function () {...}, newKeywordBuilder=function () {...}, createKeyword=function () {...}, getStatsFor=function () {...}, urls=function () {...}, isRemoved=function () {...}, isDeleted=function () {...}, enable=function () {...}, adParams=function () {...}, setMobileBidModifier=function () {...}, addPhoneNumber=function () {...}, getJson=function () {...}, addReview=function () {...}, isPaused=function () {...}, removePhoneNumber=function () {...}, createTextAd=function () {...}, removeSitelink=function () {...}, applyLabel=function () {...}, clearMobileBidModifier=function () {...}, entityType=null, display=function () {...}, removeReview=function () {...}, getEntityType=function () {...}, proxy_=function () {...}, getMobileBidModifier=function () {...}, removeMobileApp=function () {...}, pause=function () {...}, labels=function () {...}, getKeywordMaxCpc=function () {...}, negativeKeywords=function () {...}, ads=function () {...}, extensions=function () {...}, newTextAdBuilder=function () {...}, addSitelink=function () {...}, createNegativeKeyword=function () {...}, isEnabled=function () {...}, setKeywordMaxCpc=function () {...}, removeCallout=function () {...}, toString=function () {...}, removeLabel=function () {...}, addCallout=function () {...}}
{setName=function () {...}, getName=function () {...}, addMobileApp=function () {...}, keywords=function () {...}, bidding=function () {...}, getCampaign=function () {...}, getId=function () {...}, newKeywordBuilder=function () {...}, createKeyword=function () {...}, getStatsFor=function () {...}, urls=function () {...}, isRemoved=function () {...}, isDeleted=function () {...}, enable=function () {...}, adParams=function () {...}, setMobileBidModifier=function () {...}, addPhoneNumber=function () {...}, getJson=function () {...}, addReview=function () {...}, isPaused=function () {...}, removePhoneNumber=function () {...}, createTextAd=function () {...}, removeSitelink=function () {...}, applyLabel=function () {...}, clearMobileBidModifier=function () {...}, entityType=null, display=function () {...}, removeReview=function () {...}, getEntityType=function () {...}, proxy_=function () {...}, getMobileBidModifier=function () {...}, removeMobileApp=function () {...}, pause=function () {...}, labels=function () {...}, getKeywordMaxCpc=function () {...}, negativeKeywords=function () {...}, ads=function () {...}, extensions=function () {...}, newTextAdBuilder=function () {...}, addSitelink=function () {...}, createNegativeKeyword=function () {...}, isEnabled=function () {...}, setKeywordMaxCpc=function () {...}, removeCallout=function () {...}, toString=function () {...}, removeLabel=function () {...}, addCallout=function () {...}}
1
2
3
4
5
6
7
8
 
function main() {
   var placementSelector = AdWordsApp.display().placements().withCondition("PlacementUrl CONTAINS '.ro'").forDateRange('YESTERDAY').get();
  
  while(placementSelector.hasNext()) {
    var placement = placementSelector.next();
    Logger.log(placement.getAdGroup());
  }
 }
Close
 
Run script now

Tyler Sidell (AdWords Scripts Team)

unread,
Jul 6, 2016, 3:16:05 PM7/6/16
to AdWords Scripts Forum
Hi Luca,

Sounds like your script is outputting data now. Can you please let us know if you have any additional questions? You can modify Logger.log(placement.getAdGroup()); to output information about the placement. For instance if you change it to Logger.log(placement.getAdGroup().getName()); it should output the name of the ad group. All supported methods are here.


Thanks,
Tyler Sidell
AdWords Scripts Team

Luca DL

unread,
Jul 6, 2016, 4:08:35 PM7/6/16
to AdWords Scripts Forum
Yes, it is working now, I'm getting placements .ro per adgroup with:

Logger.log(placement.getAdGroup().getName());
    Logger.log(placement.getUrl());

Thank you again, I'm gonna play around with it and try to save data on a spreadshit, then add other advanced options later. 

Luca DL

unread,
Jul 11, 2016, 10:21:48 AM7/11/16
to AdWords Scripts Forum
Hello everybody, 

Is it possible to:

1- adapt and run this script at a MCC level
 
2- have the results (the placements .it or .ro or containing xyz) saved on a google spreadsheet

I'm trying to understand if I just need to add some pre-built blocks of code for each of the 2 operations or if I need to completely rethink the structure of the script. 

Thank you

Tyler Sidell (AdWords Scripts Team)

unread,
Jul 11, 2016, 11:37:53 AM7/11/16
to AdWords Scripts Forum
Hi Luca,

It would be possible to do the following.  If you want to adapt this script to run on a MCC level and export to a spreadsheet, you could use the following code to get started.  I've had to make some modifications to pull this information from a URL Performance Report.

function main() {
 
var accountIterator = MccApp.accounts().get();
 
var spreadsheet = SpreadsheetApp.openById("SPREADSHEET_ID");

 
var mccAccount = AdWordsApp.currentAccount();
 
var i=0;
 
while (accountIterator.hasNext()) {
   
var account = accountIterator.next();
   
// Switch to the account you want to process.
   
MccApp.select(account);

   
var report = AdWordsApp.report("Select Url, AdGroupName from URL_PERFORMANCE_REPORT during YESTERDAY");

   
var sheet = spreadsheet.getActiveSheet();
   
//Name sheet by account name
   
if(i == 0){
      spreadsheet
.renameActiveSheet("Report "+account.getName());
   
}
   
else if(i != 0 && !spreadsheet.getSheetByName("Report "+account.getName())){
      spreadsheet
.insertSheet("Report "+account.getName());
   
}
   
else if(i != 0 && spreadsheet.getSheetByName("Report "+account.getName())){
      spreadsheet
.setActiveSheet(spreadsheet.getSheets()[i]);
   
}
   
    report
.exportToSheet(spreadsheet.getActiveSheet());
    i
++;


   
var range = sheet.getRange("A2:G30");
    range
.sort(7);
 
}
}

Thanks,
Tyler Sidell
AdWords Scripts Team

Reply all
Reply to author
Forward
0 new messages
Search
Clear search
Close search
Google apps
Main menu