0
我试图编辑Google AdWords出价对位置脚本,以便它调整我选择的广告组的关键字出价。现在我试图在数组中使用广告组ID,将其分配给变量“campaignSelector”,然后获取该变量的关键字。以下是我到目前为止。无论出于何种原因,我都会收到错误 - TypeError:在对象[AdGroupSelector]中找不到函数关键字。 (24行)。谁能帮忙?调整AdWords应用到特定广告组的出价到位置脚本
// Ad position you are trying to achieve.
var TARGET_AVERAGE_POSITION = 3;
// Once the keywords fall within TOLERANCE of TARGET_AVERAGE_POSITION,
// their bids will no longer be adjusted.
var TOLERANCE = 0.1;
// How much to adjust the bids.
var BID_ADJUSTMENT_COEFFICIENT = 1.05;
function main() {
raiseKeywordBids();
lowerKeywordBids();
}
function raiseKeywordBids() {
// Condition to raise bid: Average position is greater (worse) than
// target + tolerance
var ids = [2123818938];
var campaignSelector = AdWordsApp.adGroups().withIds(ids);
var keywordsToRaise = campaignSelector.keywords()
.withCondition("Status = ENABLED")
.withCondition("AveragePosition > " + (TARGET_AVERAGE_POSITION + TOLERANCE))
.orderBy("AveragePosition ASC")
.forDateRange("LAST_7_DAYS")
.get();
while (keywordsToRaise.hasNext()) {
var keyword = keywordsToRaise.next();
keyword.setMaxCpc(keyword.getMaxCpc() * BID_ADJUSTMENT_COEFFICIENT);
}
}
function lowerKeywordBids() {
// Conditions to lower bid: Ctr greater than 1% AND
// average position better (less) than target - tolerance
var ids = [2123818938];
var campaignSelector = AdWordsApp.adGroups().withIds(ids);
var keywordsToLower = campaignSelector.keywords()
.withCondition("Ctr > 0.01")
.withCondition("AveragePosition < " + (TARGET_AVERAGE_POSITION - TOLERANCE))
.withCondition("Status = ENABLED")
.orderBy("AveragePosition DESC")
.forDateRange("LAST_7_DAYS")
.get();
while (keywordsToLower.hasNext()) {
var keyword = keywordsToLower.next();
keyword.setMaxCpc(keyword.getMaxCpc()/BID_ADJUSTMENT_COEFFICIENT);
}
}