Supermetrics Support Forum

Feature request (tips for Adwords inside) - Getting data for all accounts

Hello Supermetrics crew + community,


i'd like to resurrect the following topic (from poor old google forum :)

https://groups.google.com/forum/#!msg/automateanalytics/7YUtjnleZeA/oci6rmAWDwAJ


Basically, I'd like Supermetrics to let us grab data for all accounts we've access to (automatically adding new or deleting old accounts just before refreshing). It needs to be integrated into Supermetrics because otherwise the list of accounts has to be manually updated.


I found a work-around for Adwords specifically, using Adwords script on your MCC level:

 

function main() {
  var accountSelector = MccApp.accounts();
  var accountIterator = accountSelector.get();
  var accounts = [];
  while (accountIterator.hasNext()) { // loop on all accounts
    accounts.push(accountIterator.next().getCustomerId().replace(/-/g, "")); // get account ids without the 'dash' character
  }
  var ss = SpreadsheetApp.openById(" ID OF YOUR SPREADSHEET "); // you need to find the id of your spreadsheet in the URL.
  var sheet = ss.getSheetByName("SupermetricsQueries");
  var range = sheet.getRange("W24"); // this is the cell that host the config for Adwords profiles (you need to change this as well)
  range.setValue('["'+accounts.join('","')+'"]'); // build the list with the right syntax

}

  (In above script, make sure you update Spreadsheet ID + update right cell in Supermetrics sheet + trigger this every day through Adwords script console.) 


An alternative solution for Bing Ads is through the UI, when building a custom report, there's the capability to select "all accounts".


I'm still at a loss for Facebook Ads (our rep is not helpful) and Twitter Ads (platform is not mature enough, and documentation is semi-closed)





2 people like this idea
  • Hi Alex

    This script is really helpful, Thank you!


    Lately I've been having problems with the account list provided by this script - 

    When supermetrics tried to perform a report according to the account list by this script - I've been getting the following error: 

    Error: ReportDownloadError.ERROR_WRITING_REPORT_TO_FILE ReportDownloadError.ERROR_WRITING_REPORT_TO_FILE: Unable to create report


    It started a few days ago. 

    My MCC has a several sub-account, containing more child accounts. 

    I have a reason to believe that if I exclude them from the list, the script would work again.


    Do you have an idea on how this great code can be improved in a way we could exclude account ID's that we pre-enter as "var"'s ?


    Thanks in advance!


    Itai

  • Itai,

    I'm having the same issue. I also cannot trigger the script to push the CID list to my Google Sheet. I'm currently talking to Google AdWords support to make sure it's not a script issue.

  • So, my issue with this script is due to having too many accounts. The CID string is too long.

Login to post a comment