2016-04-28 29 views
1

我一直在使用此節點模塊:https://www.npmjs.com/package/googleads-node-lib,並且能夠使用它更改跟蹤模板和CpcBid microAmount,但無法弄清楚爲什麼它不會更改關鍵字文本。相關代碼如下:AdGroupCriterionService沒有更改關鍵字文本

var budget = new service.Model(attributes); 

// Change Keyword text (doesn't work) 
budget.attributes.criterion.text = 'superawesomekeyword'; 

// Also tried this line below but it doesn't work either. 
budget.set('criterion', {'attributes': {'xsi:type': 'Keyword'}, 
             'id': 175369767649, 
             'type': 'KEYWORD', 
             'Criterion.Type': 'Keyword', 
             'text': 'superawesomekeyword', 
             'matchType': 'EXACT'})  

// Change CPC Bid <---- This works 
budget.attributes.biddingStrategyConfiguration.bids[0].bid.microAmount = 80000000; 

// Change Tracking Template URL <---- This also works 
budget.set('trackingUrlTemplate', 'http://test.com'); 

service.mutateSet(process.env.GOOGLE_CLIENT_CUSTOMER_ID, budget, function(err, results) { 
    if (err) { 
     console.log(err); 
    } 

    else { 
      console.log(JSON.stringify(results, null, 2)); 
    } 
} 

控制檯輸出顯示跟蹤模板和microAmount已更改,但沒有關鍵字文本。 Console Output

+1

如果您更改關鍵字文本,就像更改關鍵字,而不是相同的ID,不是嗎? – fabrigm

+0

好點。是的,更改關鍵字文字確實會更改ID。我想我可以先刪除關鍵字,然後添加一個新的關鍵字,儘管這需要更多的操作。有什麼方法可以使用Set運算符來更改關鍵字文本嗎? – cdv

+1

我相信你必須創建新的關鍵字... – fabrigm

回答

0

創建新關鍵字而不是嘗試更改它,如果關鍵字創建成功,則刪除舊關鍵字。