Palabras clave negativas
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Agregar palabra clave negativa a una campaña
function addNegativeKeywordToCampaign(keyword, campaignName) {
const campaignIterator = AdsApp.campaigns()
.withCondition(`campaign.name = "${campaignName}"`)
.get();
if (campaignIterator.hasNext()) {
const campaign = campaignIterator.next();
campaign.createNegativeKeyword(keyword);
} else {
throw new Error(`Cannot find campaign with the name '${campaignName}'`);
}
}
Obtener palabras clave negativas en una campaña
function getNegativeKeywordsForCampaign(campaignName) {
const campaignIterator = AdsApp.campaigns()
.withCondition(`campaign.name = "${campaignName}"`)
.get();
if (campaignIterator.hasNext()) {
const campaign = campaignIterator.next();
const negativeKeywordIterator = campaign.negativeKeywords().get();
console.log(`Found ${negativeKeywordIterator.totalNumEntities()} negative keywords.`);
return negativeKeywordIterator;
} else {
throw new Error(`Cannot find campaign with the name '${campaignName}'`);
}
}
Agregar una palabra clave negativa a un grupo de anuncios
function addNegativeKeywordToAdGroup(keyword, adGroupName) {
const adGroupIterator = AdsApp.adGroups()
.withCondition(`ad_group.name = "${adGroupName}"`)
.get();
if (!adGroupIterator.hasNext()) {
throw new Error(`Cannot find ad group with the name '${adGroupName}'`);
}
if (adGroupIterator.totalNumEntities() > 1) {
console.warn(`Found more than one ad group named '${adGroupName}', using the first one.`);
}
const adGroup = adGroupIterator.next();
adGroup.createNegativeKeyword(keyword);
}
Obtener palabras clave negativas en un grupo de anuncios
function getNegativeKeywordsForAdGroup(adGroupName) {
const adGroupIterator = AdsApp.adGroups()
.withCondition(`ad_group.name = "${adGroupName}"`)
.get();
if (!adGroupIterator.hasNext()) {
throw new Error(`Cannot find ad group with the name '${adGroupName}'`);
}
if (adGroupIterator.totalNumEntities() > 1) {
console.warn(`Found more than one ad group named '${adGroupName}', using the first one.`);
}
const adGroup = adGroupIterator.next();
const negativeKeywordIterator = adGroup.negativeKeywords().get();
if (negativeKeywordIterator.hasNext()) {
const negativeKeyword = negativeKeywordIterator.next();
console.log(`Found ${negativeKeywordIterator.totalNumEntities()} negative keywords.`);
return negativeKeywordIterator;
}
}
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2024-09-12 (UTC)
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Falta la información que necesito"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Muy complicado o demasiados pasos"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Desactualizado"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"Problema de traducción"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Problema con las muestras o los códigos"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Otro"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Fácil de comprender"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Resolvió mi problema"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Otro"
}]
{"lastModified": "\u00daltima actualizaci\u00f3n:\u00a02024-09-12 (UTC)"}
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2024-09-12 (UTC)"]]