调整 Adwords 竞价排名脚本以应用于特定广告组
Adjust Adwords bid-to-position script to apply to specific ad groups
我正在尝试编辑 Google AdWords Bid-To-Position 脚本,以便它会调整我选择的广告组的关键字出价。现在我正在尝试使用数组中的广告组 ID,将其分配给变量 "campaignSelector",然后获取该变量的关键字。以下是我到目前为止所拥有的。无论出于何种原因,我不断收到错误 - TypeError:无法在对象 [AdGroupSelector] 中找到函数关键字。 (第 24 行)。有人可以帮忙吗?
// 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);
}
}
// Ad position you are trying to achieve.
var TARGET_AVERAGE_POSITION = 1;
// 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 = [];
var AdGroupSelector = AdWordsApp.adGroups().withIds(ids);
var adGroupIterator = AdGroupSelector.get();
while (adGroupIterator.hasNext()) {
var adGroup = adGroupIterator.next();
var keywordsToRaise = adGroup.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 = [];
var AdGroupSelector = AdWordsApp.adGroups().withIds(ids);
var adGroupIterator = AdGroupSelector.get();
while (adGroupIterator.hasNext()) {
var adGroup = adGroupIterator.next();
var keywordsToLower = adGroup.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);
}
}
}
我正在尝试编辑 Google AdWords Bid-To-Position 脚本,以便它会调整我选择的广告组的关键字出价。现在我正在尝试使用数组中的广告组 ID,将其分配给变量 "campaignSelector",然后获取该变量的关键字。以下是我到目前为止所拥有的。无论出于何种原因,我不断收到错误 - TypeError:无法在对象 [AdGroupSelector] 中找到函数关键字。 (第 24 行)。有人可以帮忙吗?
// 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);
}
}
// Ad position you are trying to achieve.
var TARGET_AVERAGE_POSITION = 1;
// 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 = [];
var AdGroupSelector = AdWordsApp.adGroups().withIds(ids);
var adGroupIterator = AdGroupSelector.get();
while (adGroupIterator.hasNext()) {
var adGroup = adGroupIterator.next();
var keywordsToRaise = adGroup.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 = [];
var AdGroupSelector = AdWordsApp.adGroups().withIds(ids);
var adGroupIterator = AdGroupSelector.get();
while (adGroupIterator.hasNext()) {
var adGroup = adGroupIterator.next();
var keywordsToLower = adGroup.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);
}
}
}