با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
اسکریپتهای Google Ads به بهترین شکل اجرا میشوند: آنها سعی میکنند تغییراتی در دادههای Google Ads ایجاد کنند، اما اگر تغییر خاصی موفقیتآمیز نباشد، اسکریپت آن را در گزارش تغییرات ثبت میکند و با اجرا ادامه میدهد:
// Attempt an invalid change.letamount=999999999999;campaign.getBudget().setAmount(amount);// Error is logged into Changes log, but the script keeps running.// Suppose we must know whether the change actually happened.if(campaign.getBudget()!=amount){// The current value of budget is not the one we expected.// The change must have failed.}
عملیات هایی که خطاهای مشابه را خروجی می کنند عبارتند از:
تنظیم پیشنهاد کلمه کلیدی بزرگتر از بودجه کمپین.
تنظیم نام کمپین به نامی که از قبل وجود دارد.
ایجاد یک گروه تبلیغاتی در کمپینی که قبلاً به سهمیه خود برای گروه های تبلیغاتی رسیده است.
با این حال، برخی از خطاها را نمی توان نادیده گرفت. در اینجا یک مثال است:
با استفاده از این کد، اسکریپت نمی تواند یک تکرار کننده keywords معنی دار تولید کند زیرا محدوده تاریخ مشخص نشده است. بنابراین اجرای اسکریپت متوقف می شود و یک پیام خطا در گزارش های متنی ثبت می شود.
در صورت تجاوز از سهمیه، هشدارها توسط اسکریپت ثبت میشوند. اجرای اسکریپت همچنان ادامه خواهد داشت، اما همیشه باید هشدارها را مرور کنید.
تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eGoogle Ads scripts will log errors when changes fail but continue running, allowing you to check if a change was successful and handle it accordingly.\u003c/p\u003e\n"],["\u003cp\u003eCertain errors, such as missing required parameters, will halt script execution and require fixing before the script can run.\u003c/p\u003e\n"],["\u003cp\u003eWhile scripts proceed even when exceeding quotas, warnings are logged and should be reviewed.\u003c/p\u003e\n"],["\u003cp\u003eScript execution logs provide valuable information through errors (red), warnings (orange), and custom messages for debugging and monitoring.\u003c/p\u003e\n"],["\u003cp\u003eSuccessfully returned objects from Google Ads scripts are safe to use, indicating the operation was successful.\u003c/p\u003e\n"]]],[],null,["# Errors and Warnings\n\nGoogle Ads scripts execute in best-effort fashion: They attempt to make changes\nto Google Ads data, but if a certain change is not successful, the script\nrecords it into the [Changes log](/google-ads/scripts/docs/concepts/execution-logs)\nand proceeds with the execution: \n\n // Attempt an invalid change.\n let amount = 999999999999;\n campaign.getBudget().setAmount(amount);\n // Error is logged into Changes log, but the script keeps running.\n\n // Suppose we must know whether the change actually happened.\n if (campaign.getBudget() != amount) {\n // The current value of budget is not the one we expected.\n // The change must have failed.\n }\n\nOperations that output similar errors include:\n\n- Setting a keyword bid larger than the campaign budget.\n- Setting a campaign name to one that already exists.\n- Creating an ad group in a campaign that has already reached its quota for ad groups.\n\nSome errors, however, cannot be ignored. Here is an example: \n\n let keywords = AdsApp.keywords()\n .withCondition(\"metrics.clicks \u003e 10\")\n // Forgot forDateRange().\n .get();\n\nWith this code, the script cannot produce a meaningful `keywords` iterator\nsince the date range is not specified. Thus the script execution will halt, and\nan error message logged to the text logs.\n| **Key Point:** When Google Ads scripts successfully returns an object, it is safe to work with. An error would occur if fetching of an object failed.\n\nWarnings are logged by the script if\n[quotas](/google-ads/scripts/docs/limits) are exceeded. The script\nexecution will still proceed, but you should always review warnings.\n\nErrors are red and warnings are orange in execution logs. You can also\n[output custom messages](/google-ads/scripts/docs/concepts/execution-logs)\nto these logs for troubleshooting and monitoring purposes."]]