Kampagnen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Alle Kampagnen abrufen
function getAllCampaigns() {
// AdsApp.campaigns() will return all campaigns that are not removed by
// default.
const campaignIterator = AdsApp.campaigns().get();
console.log(`Total campaigns found : ${campaignIterator.totalNumEntities()}`);
return campaignIterator;
}
Kampagne anhand des Namens abrufen
function getCampaignByName(name) {
const campaignIterator = AdsApp.campaigns()
.withCondition(`campaign.name = "${name}"`)
.get();
if (campaignIterator.hasNext()) {
const campaign = campaignIterator.next();
console.log(`Campaign Name: ${campaign.getName()}`);
console.log(`Enabled: ${campaign.isEnabled()}`);
console.log(`Bidding strategy: ${campaign.getBiddingStrategyType()}`);
console.log(`Ad rotation: ${campaign.getAdRotationType()}`);
console.log(`Start date: ${formatDate(campaign.getStartDate())}`);
console.log(`End date: ${formatDate(campaign.getEndDate())}`);
return campaign;
} else {
throw new Error(`No campaign named "${name}" found`);
}
}
function formatDate(date) {
function zeroPad(number) { return Utilities.formatString('%02d', number); }
return (date == null) ? 'None' : zeroPad(date.year) + zeroPad(date.month) +
zeroPad(date.day);
}
Statistiken einer Kampagne abrufen
function getCampaignStats(name) {
const campaignIterator = AdsApp.campaigns()
.withCondition(`campaign.name = "${name}"`)
.get();
if (campaignIterator.hasNext()) {
const campaign = campaignIterator.next();
// You can also request reports for pre-defined date ranges. See
// https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_campaign#getStatsFor_1,
// DateRangeLiteral section for possible values.
const stats = campaign.getStatsFor('LAST_MONTH');
console.log(`${campaign.getName()}: ${stats.getClicks()} clicks, ${stats.getImpressions()} impressions`);
return stats;
} else {
throw new Error(`No campaign named "${name}" found`);
}
}
Kampagne pausieren
function pauseCampaign(name) {
const campaignIterator = AdsApp.campaigns()
.withCondition(`campaign.name = "${name}"`)
.get();
if (campaignIterator.hasNext()) {
const campaign = campaignIterator.next();
campaign.pause();
} else {
throw new Error(`No campaign named "${name}" found`);
}
}
Gebotsanpassungen für Geräte aus einer Kampagne abrufen
function getCampaignBidModifiers(name) {
const campaignIterator = AdsApp.campaigns()
.withCondition(`campaign.name = "${name}"`)
.get();
if (campaignIterator.hasNext()) {
const campaign = campaignIterator.next();
console.log('Campaign name: ' + campaign.getName());
const platforms = {};
for (const platform of campaign.targeting().platforms()) {
console.log(`${platform.getName()} bid modifier: ${platform.getBidModifier()}`);
platforms[platform.getName()] = platform.getBidModifier();
}
return platforms;
} else {
throw new Error(`No campaign named "${name}" found`);
}
}
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2024-09-12 (UTC).
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Benötigte Informationen nicht gefunden"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Zu umständlich/zu viele Schritte"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Nicht mehr aktuell"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"Problem mit der Übersetzung"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Problem mit Beispielen/Code"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Sonstiges"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Leicht verständlich"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Mein Problem wurde gelöst"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Sonstiges"
}]
{"lastModified": "Zuletzt aktualisiert: 2024-09-12\u00a0(UTC)."}
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2024-09-12 (UTC)."]]