Using the Console to debug scripts
If you're new to Google Ads Scripts, you'll find that most scripts generate some form of output and execution data via Execution Logs. This is particularly useful for script developers for debugging and monitoring script performance.
When a script runs a command like Logger.log("Hello world!");, the message "Hello world!" will appear in the logger output. This output can be viewed in two different sections within the Google Ads interface:
Previewing a Script:
After you've written or pasted your code into the Google Ads Scripts editor, you have the option to preview the script. When you click on 'Preview,' the script will execute without making any changes to your account. You can then view the logger output under the 'LOGS' tab.
Running a Script:
When you execute a script, the logger output can be accessed through the 'SCRIPT HISTORY' section. Make sure to select the correct date to view the logger output for that day's execution. Locate the script whose logs you wish to inspect and click on 'log statements'.
Thought-Provoking Questions and Insights
Debugging and Monitoring: How can the logger output help in debugging and monitoring the performance of Google Ads Scripts?
Script Execution: What are the benefits of previewing a script before running it in your Google Ads account?
Logger Utility: How can understanding the logger output improve your overall experience with Google Ads Scripts?