विज्ञापन कस्टमाइज़र
एक विज्ञापन कस्टमाइज़र डेटा स्रोत बनाएं
function createMixersAdCustomizerSource() {
// This example snippet creates an ad customizer source named "Mixers", modeled after
// the example data shown at https://support.google.com/google-ads/answer/6072565.
const sourceName = 'Mixers';
// Ad Customizer attributes can be added one at a time with `addAttribute` or all at
// once with `addAttributes`.
const mixersSourceOperation = AdsApp.newAdCustomizerSourceBuilder()
.withName(sourceName)
.addAttribute('Model', 'text')
.addAttributes({
'Capacity': 'number',
'Type': 'text',
'Start_price': 'price',
'Sale_ends': 'date',
})
.build();
return mixersSourceOperation;
}
नाम के आधार पर विज्ञापन कस्टमाइज़र डेटा स्रोत खोजें
function getAdCustomizerSourceByName(sourceName) {
let sourceCount = 0;
let foundSource = null;
for (const source of AdsApp.adCustomizerSources()) {
if (source.getName() === sourceName) {
foundSource = source;
sourceCount += 1;
}
}
if (foundSource === null) {
throw new Error(`No Ad Customizer Source found with name "${sourceName}"`);
}
if (sourceCount > 1) {
console.warn(`Found ${sourceCount} Ad Customizer Sources with name "${sourceName}", returning just one of them`);
}
console.log(`Source "${foundSource.getName()}" has attributes ${foundSource.getAttributes()}`);
return foundSource;
}
डेटा स्रोत के कस्टमाइज़र आइटम प्राप्त करें
function getAdCustomizerItems(sourceName) {
let sourceCount = 0;
let foundSource = null;
for (const source of AdsApp.adCustomizerSources()) {
if (source.getName() === sourceName) {
foundSource = source;
sourceCount += 1;
}
}
if (foundSource === null) {
throw new Error(`No Ad Customizer Source found with name "${sourceName}"`);
}
if (sourceCount > 1) {
console.warn(`Found ${sourceCount} Ad Customizer Sources with name "${sourceName}", using just one of them`);
}
const itemIterator = foundSource.items().get();
console.log(`Source "${foundSource.getName()}" has ${itemIterator.totalNumEntities()} items`);
return itemIterator;
}
विज्ञापन कस्टमाइज़र आइटम बनाएं
function createMixersAdCustomizerItem() {
// This example snippet creates an ad customizer item in the source named "Mixers",
// modeled after the example data shown at
// https://support.google.com/google-ads/answer/6072565.
const sourceName = 'Mixers';
let sourceCount = 0;
let mixersSource = null;
for (const source of AdsApp.adCustomizerSources()) {
if (source.getName() === sourceName) {
mixersSource = source;
sourceCount += 1;
}
}
if (mixersSource === null) {
throw new Error(`No Ad Customizer Source found with name "${sourceName}"`);
}
if (sourceCount > 1) {
console.warn(`Found ${sourceCount} Ad Customizer Sources with name "${sourceName}", using just one of them`);
}
// Item values can be specified one at a time with `withAttributeValue` or all at once
// with `withAttributeValues`.
const mixersItemOperation = mixersSource.adCustomizerItemBuilder()
.withAttributeValue('Model', 'ProWhip 300')
.withAttributeValues({
'Capacity': 5,
'Type': 'tilt-head',
'Start_price': '$199',
'Sale_ends': '20150515 200000',
})
.withTargetKeyword('prowhip 300')
.build();
return mixersItemOperation;
}
विज्ञापन कस्टमाइज़र की मदद से बड़ा किया गया टेक्स्ट विज्ञापन बनाना
function createCustomizedMixersExpandedTextAd() {
// This example snippet creates an ad in the ad group named "Kitchen Store" that
// shows details based on the data in the ad customizer named "Mixers". This
// example is modeled after https://support.google.com/google-ads/answer/6072565.
const adGroupName = 'Kitchen Store';
const adGroupIterator = AdsApp.adGroups()
.withCondition(`ad_group.name = "${adGroupName}"`)
.get();
if (!adGroupIterator.hasNext()) {
throw new Error(`No Ad Group found with name "${adGroupName}"`);
}
if (adGroupIterator.totalNumEntities() > 1) {
console.warn(`Found ${adGroupIterator.totalNumEntities()} Ad Groups with name "${adGroupName}", using just one of them`);
}
const adGroup = adGroupIterator.next();
const mixersAdOperation = adGroup.newAd().expandedTextAdBuilder()
.withHeadlinePart1('{=Mixers.model}')
.withHeadlinePart2('Stand Mixer')
.withDescription1('{=Mixers.Capacity} quart {=Mixers.Type} stand mixer.')
.withDescription2('{=Mixers.Start_price} - sale ends in {=COUNTDOWN(Mixers.Sale_ends)}.')
.withFinalUrl('http://www.example.com')
.build();
return mixersAdOperation;
}
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2024-09-12 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2024-09-12 (UTC) को अपडेट किया गया."],[[["The provided code snippets demonstrate how to manage Ad Customizer data sources and items within Google Ads scripts."],["You can create, find, and retrieve items from an Ad Customizer data source using dedicated functions."],["Ad Customizer items can be associated with specific keywords for targeted ad delivery."],["The code showcases how to build Expanded Text Ads that dynamically insert data from Ad Customizer sources using placeholders like `{=Mixers.Model}`."],["These snippets use a 'Mixers' example source with attributes like Model, Capacity, and Sale_ends to illustrate the functionality."]]],[]]