Follow these steps to launch your first script.

### Google Ads accounts

1. [Sign in](https://ads.google.com/) to your Google Ads account.
2. From the Tools menu in the left navigation, select **Bulk actions** , then **Scripts**. You can also navigate to this page by searching for "Scripts" in the Google Ads search bar.
3. Press the + icon ![blue circle with white plus](https://developers.google.com/static/google-ads/scripts/images/add_script.png) to add a script. You can browse script templates from the drop-down menu, but for the sake of this exercise, select "New script".
4. You can optionally provide a name for your script in the "Script name" text field. This can help you stay organized and remember what the script does.
5. Copy and paste the following code into the editor area, replacing the main
   function:

       function main() {
         // Get the campaign names from all the campaigns
         const rows = AdsApp.search('SELECT campaign.name FROM campaign');

         console.log('My campaigns:');
         // Iterate through the campaigns and print the campaign names
         for (const row of rows) {
           console.log(row.campaign.name);
         }
       }

6. When prompted, click **Authorize** so the script can access the account on
   your behalf. This has to be done once for each script.

7. Click **Preview** to run the script in [preview mode](https://developers.google.com/google-ads/scripts/docs/preview).
   Results will appear in the **Changes** / **Logs** panel. For this example,
   you should see your campaign names displayed in the Logs.

8. When you're happy with the preview results, click **Run** to run your
   script and open the **Script history** page. This page displays the
   most recently run scripts, with information on their status and results.

9. To get a detailed view of changes and logs, click the link in the
   **Changes** column that corresponds to the script you just ran. You should
   see the same log output that was previewed before.

### Manager accounts

You must first have a
[Google Ads manager account](https://support.google.com/google-ads/answer/6139186)
to run Ads Manager scripts.

1. [Sign in](https://ads.google.com/) to your Google Ads manager account.
2. From the Tools menu in the left navigation, select **Bulk actions** , then **Scripts**. You can also navigate to this page by searching for "Scripts" in the Google Ads search bar.
3. Press the + icon ![blue circle with white plus](https://developers.google.com/static/google-ads/scripts/images/add_script.png) to add a script. You can browse script templates from the drop-down menu, but for the sake of this exercise, select "New script".
4. You can optionally provide a name for your script in the "Script name" text field. This can help you stay organized and remember what the script does.
5. Copy and paste the following code into the editor area, replacing the main
   function:

       function main() {
         // Retrieve all children accounts.
           const accountIterator = AdsManagerApp.accounts().get();

         // Iterate through the account list.
         for (const account of accountIterator) {
           // Get stats for the child account.
           const stats = account.getStatsFor("THIS_MONTH");
           // And log it.
           console.log(`${account.getCustomerId()},${stats.getClicks()},` +
             `${stats.getImpressions()},${stats.getCost()}`);
         }
       }

6. When prompted, click **Authorize** so the script can access the account on
   your behalf. This has to be done once for each script.

7. Click **Preview** to run the script in [preview mode](https://developers.google.com/google-ads/scripts/docs/preview).
   Results will appear in the **Changes** / **Logs** panel. For this example,
   you should see your children accounts and their metrics displayed in the
   Logs.

8. When you're happy with the preview results, click **Run** to run your
   script and open the **Script history** page. This page displays the
   most recently run scripts, with information on their status and results.

9. To get a detailed view of changes and logs, click the link in the
   **Changes** column that corresponds to the script you just ran. You should
   see the same log output that was previewed before.

For more sample script snippets, check out our
[examples page](https://developers.google.com/google-ads/scripts/docs/examples).