With the script below, I find a number of keywords with AdWordsApp.keywords() based on some parameters. Once these words are found, they must be paused.

My question is the following: How can I use the same list of ExactKeywords, that I have already found, to activate the same keyword in another campaign with a different name than CampaignName?


   var Exact_CampaignName = "CampaignName_1";          function main() {       // Getting list of keywords with cliks       var kw_Conv_Exact = AdWordsApp.keywords()         .withCondition("Click >= 50")         .withCondition("Status = ENABLED")         .withCondition(Exact_CampaignName)         .get();                      // Get Keywords from Campaigns_1       var ExactKeywords = [];       while (kw_Conv_Exact.hasNext()) {         var kw_exact = kw_Conv_Exact.next();         ExactKeywords.push(kw_exact);                       // Pause exaxt keywords.         for(var i in ExactKeywords) {           ExactKeywords[i].pause();         }   //But how do I enable the same keywords from var ExactKeywords = [] but in another campaign_2???      } 


Thanks in advance

Tag:google-ads-api, javascript, match

2 comments.

  1. DCR

    why not just make a copy?

    var ExactKeywords = []; var ExactKeywords2=[]; while (kw_Conv_Exact.hasNext()) { var kw_exact = kw_Conv_Exact.next(); ExactKeywords.push(kw_exact); ExactKeywords2.push(kw_exact); Run code snippet

    Hide resultsExpand snippet

    1. Smedegaard

      This script pauses keywords in campaign_1 and then activates them again in campaign_1 But the script should pause keywords in campaign_1 and then re-enable them in campaign_2 code // Now go through each one and pause keyword in Campaign_1. for(var i in ExactKeywords) { ExactKeywords[i].pause(); } // Now go through each one and enable them in Campaign_2. for(var i in ExactKeywords2) { ExactKeywords2[i].enable(); } code

Add a new comment.