وسائل شرح
تنظيم صفحاتك في مجموعات يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
إنشاء إضافة وسيلة شرح
function createCallout() { // For full details on creating a new callout extension, see: // https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_calloutbuilder const newCallout = AdsApp.extensions().newCalloutBuilder() // Replace the values below with your text, and mobile preferred .withText('Free Shipping') // required .withMobilePreferred(true) // optional .build() .getResult(); // Add callout to a campaign const campaignIterator = AdsApp.campaigns() .withCondition('campaign.name = "INSERT_CAMPAIGN_NAME_HERE"') .get(); if (campaignIterator.hasNext()) { const campaign = campaignIterator.next(); campaign.addCallout(newCallout); } // Add callout to an ad group const adGroupIterator = AdsApp.adGroups() .withCondition('campaign.name = "INSERT_CAMPAIGN_NAME_HERE"') .withCondition('ad_group.name = "INSERT_AD_GROUP_NAME_HERE"') .get(); if (adGroupIterator.hasNext()) { const adGroup = adGroupIterator.next(); adGroup.addCallout(newCallout); } // Add callout to an account const account = AdsApp.currentAccount(); account.addCallout(newCallout); }
تسجيل تفاصيل وسيلة الشرح لحملة
function logCalloutDetails() { // Get a campaign. const campaignIterator = AdsApp.campaigns() .withCondition('campaign.name = "INSERT_CAMPAIGN_NAME_HERE"') .get(); if (!campaignIterator.hasNext()) { throw new Error('Campaign not found.'); } const campaign = campaignIterator.next(); // Retrieve the campaign's callouts. Retrieving an ad group's and // account's calloutss is similar. const calloutIterator = campaign.extensions().callouts().get(); for (const callout of calloutIterator) { // You can also request reports for pre-defined date ranges. See // https://developers.google.com/adwords/api/docs/guides/awql, // DateRangeLiteral section for possible values. const stats = callout.getStatsFor('LAST_MONTH'); console.log(`Callout text : ${ callout.getText() }`); console.log(`mobile preferred : ${ callout.isMobilePreferred() }`); console.log(`clicks : ${ stats.getClicks() }`); console.log(`impressions : ${ stats.getImpressions() }`); console.log('======='); } console.log(`${calloutIterator.totalNumEntities()} callouts in the campaign`); }
ضبط جدول زمني لوسائل الشرح في حملة
function setCalloutSchedule() { // Get a campaign. const campaignIterator = AdsApp.campaigns() .withCondition('campaign.name = "INSERT_CAMPAIGN_NAME_HERE"') .get(); if (!campaignIterator.hasNext()) { throw new Error('Campaign not found.'); } const campaign = campaignIterator.next(); // Retrieve the campaign's callouts. Retrieving an ad group's and // account's saitelinks is similar. const calloutIterator = campaign.extensions().callouts().get(); for (const callout of calloutIterator) { if (callout.getText() == 'Free Shipping') { // Set callout extension schedule to run only on Mondays and Tuesdays, // 9 AM to 6 PM. You can follow a similar approach to set schedules for // other ad extension types. const monday = { dayOfWeek: 'MONDAY', startHour: 9, startMinute: 0, endHour: 18, endMinute: 0 }; const tuesday = { dayOfWeek: 'TUESDAY', startHour: 9, startMinute: 0, endHour: 18, endMinute: 0 }; callout.setSchedules([monday, tuesday]); return; } } }
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-08-21 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-08-21 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThis script provides functions for creating, analyzing, and scheduling Google Ads callout extensions.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ecreateCallout()\u003c/code\u003e demonstrates how to generate a new callout and associate it with a campaign, ad group, or account.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003elogCalloutDetails()\u003c/code\u003e retrieves and displays performance metrics for callouts within a specified campaign.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esetCalloutSchedule()\u003c/code\u003e enables scheduling callouts to run on specific days and times, illustrated with a Monday-Tuesday, 9 AM-6 PM example.\u003c/p\u003e\n"]]],[],null,["Create a callout extension \n\n```gdscript\nfunction createCallout() {\n // For full details on creating a new callout extension, see:\n // https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_calloutbuilder\n const newCallout = AdsApp.extensions().newCalloutBuilder()\n // Replace the values below with your text, and mobile preferred\n .withText('Free Shipping') // required\n .withMobilePreferred(true) // optional\n .build()\n .getResult();\n\n // Add callout to a campaign\n const campaignIterator = AdsApp.campaigns()\n .withCondition('campaign.name = \"INSERT_CAMPAIGN_NAME_HERE\"')\n .get();\n if (campaignIterator.hasNext()) {\n const campaign = campaignIterator.next();\n campaign.addCallout(newCallout);\n }\n\n // Add callout to an ad group\n const adGroupIterator = AdsApp.adGroups()\n .withCondition('campaign.name = \"INSERT_CAMPAIGN_NAME_HERE\"')\n .withCondition('ad_group.name = \"INSERT_AD_GROUP_NAME_HERE\"')\n .get();\n if (adGroupIterator.hasNext()) {\n const adGroup = adGroupIterator.next();\n adGroup.addCallout(newCallout);\n }\n\n // Add callout to an account\n const account = AdsApp.currentAccount();\n account.addCallout(newCallout);\n}\n```\n\nLog callout details for a campaign \n\n```gdscript\nfunction logCalloutDetails() {\n // Get a campaign.\n const campaignIterator = AdsApp.campaigns()\n .withCondition('campaign.name = \"INSERT_CAMPAIGN_NAME_HERE\"')\n .get();\n if (!campaignIterator.hasNext()) {\n throw new Error('Campaign not found.');\n }\n const campaign = campaignIterator.next();\n\n // Retrieve the campaign's callouts. Retrieving an ad group's and\n // account's calloutss is similar.\n const calloutIterator = campaign.extensions().callouts().get();\n for (const callout of calloutIterator) {\n // You can also request reports for pre-defined date ranges. See\n // https://developers.google.com/adwords/api/docs/guides/awql,\n // DateRangeLiteral section for possible values.\n const stats = callout.getStatsFor('LAST_MONTH');\n\n console.log(`Callout text : ${ callout.getText() }`);\n console.log(`mobile preferred : ${ callout.isMobilePreferred() }`);\n console.log(`clicks : ${ stats.getClicks() }`);\n console.log(`impressions : ${ stats.getImpressions() }`);\n console.log('=======');\n }\n\n console.log(`${calloutIterator.totalNumEntities()} callouts in the campaign`);\n}\n```\n\nSet schedule for callouts in a campaign \n\n```gdscript\nfunction setCalloutSchedule() {\n // Get a campaign.\n const campaignIterator = AdsApp.campaigns()\n .withCondition('campaign.name = \"INSERT_CAMPAIGN_NAME_HERE\"')\n .get();\n if (!campaignIterator.hasNext()) {\n throw new Error('Campaign not found.');\n }\n const campaign = campaignIterator.next();\n\n // Retrieve the campaign's callouts. Retrieving an ad group's and\n // account's saitelinks is similar.\n const calloutIterator = campaign.extensions().callouts().get();\n\n for (const callout of calloutIterator) {\n if (callout.getText() == 'Free Shipping') {\n // Set callout extension schedule to run only on Mondays and Tuesdays,\n // 9 AM to 6 PM. You can follow a similar approach to set schedules for\n // other ad extension types.\n const monday = {\n dayOfWeek: 'MONDAY',\n startHour: 9,\n startMinute: 0,\n endHour: 18,\n endMinute: 0\n };\n\n const tuesday = {\n dayOfWeek: 'TUESDAY',\n startHour: 9,\n startMinute: 0,\n endHour: 18,\n endMinute: 0\n };\n\n callout.setSchedules([monday, tuesday]);\n\n return;\n }\n }\n}\n```"]]