Created
October 27, 2016 15:14
-
-
Save royharmon4/560ebaab757b1b3e20bf48e192119ee4 to your computer and use it in GitHub Desktop.
Pulling AdWords impression share data into an AdWords script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will pull impression share data into a script for you to use: | |
function main() { | |
var accountIterator = MccApp.accounts().get(); | |
var mccAccount = AdWordsApp.currentAccount(); | |
while (accountIterator.hasNext()) { | |
var account = accountIterator.next(); | |
MccApp.select(account); | |
var accountName = account.getName(); | |
Logger.log(accountName); | |
var report = AdWordsApp.report( | |
"SELECT CampaignName, SearchImpressionShare, SearchRankLostImpressionShare, SearchBudgetLostImpressionShare " + | |
"FROM CAMPAIGN_PERFORMANCE_REPORT " + | |
"WHERE AdvertisingChannelType IN [SEARCH] " + | |
"DURING THIS_MONTH", { | |
includeZeroImpressions: false | |
}); | |
var rows = report.rows(); | |
while (rows.hasNext()) { | |
var row = rows.next(); | |
var cName = row['CampaignName']; | |
var iShare = row['SearchImpressionShare']; | |
var iShareRank = row['SearchRankLostImpressionShare']; | |
var iShareBudget = row['SearchBudgetLostImpressionShare']; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment