How can I automate my campaigns with Bing Ads Scripts?

How can I automate my campaigns with Bing Ads Scripts?

Learn how to automate your account and campaigns with Bing Ads Scripts.

Bing Ads Scripts are pieces of JavaScript code you can use to automatically create, change, or delete items in your account based on custom criteria. You can make hundreds (or thousands!) of changes across your account all at once, without needing to make the changes manually.

Here are some examples of using scripts:

  • Schedule campaigns linked to a launch or sale.
  • Have an ad pause automatically when the item it's advertising is out of stock.
  • Make a rule across your account to increase broad-match keyword bids by 25% for keywords that generated more than 100 impressions that day.

Using Bing Ads Scripts

Who should use scripts? expando image

Scripts are most helpful for people who manage large campaigns and/or a large number of campaigns. It also helps to have some experience scripting in JavaScript.

It's important to keep in mind that Bing Ads Scripts can make wide-ranging changes to your campaigns, and that scripts do not have an "Undo" button. If you find this prospect daunting, then automated rules might be more suitable for you.

How do I create and run Bing Ads Scripts? expando image
  1. On the left navigation pane, click Bulk Operations and then Scripts. This is the main Scripts page where you will see any scripts you have already created.
  2. Click Create script.
  3. In the script editor, write or paste in your script.
    1. To see example scripts that you can copy, click Show examples.
    2. For instructions on scripting, take a look at our Scripts documentation, and for more script snippets you can copy, check out our scripts code examples.
  4. Click Save.
  5. Click Preview to see a list of all the changes this script will make. Previewing a script is optional, but is strongly recommended.
  6. If you want to run the script right away, click Run script now.
  7. If you want to run the script at a certain time, or at multiple specific times, click Create schedule.
Notes
  • If you have multiple accounts and want to run a script across them, you'll need to create the script from your Accounts Summary page — click Bulk Operations and then Scripts.
  • If you share accounts with other account managers, be aware that only the author of a script will be able to see and run that script.
How do I manage scripts? expando image

After you run a script, it will appear under Logs on the main Scripts page. There you will see when the script ran, how long it took to run, how many changes were made, and how many changes failed. For more information on what the script did:

  1. In the script's Summary column, click View details.
  2. On the script's Log details page, you'll see all the changes the script made.
  3. To see how the script made these changes — as well as any errors encountered and log messages you included with the script — click Logs.

To run a script that you have already created:

  1. Find the script in your list of previously-created scripts on the main Scripts page.
  2. Click Run — or click Create schedule to have the script run at a certain time, or at multiple specific times.

Can I use the scripts that I created in Google Ads? expando image
Yes, just paste them right in. When you click Save, we will automatically make some changes to make them compatible with Bing Ads. However, you will need to update the script manually to fix the following compatibility issues:
  • If the script calls the budget selector, it returns only shared budgets. To get a campaign's individual budget, you must access it directly from the campaign.
  • If the script includes IDs, you’ll need to turn them into strings by wrapping them in double quotation marks. For example, you’ll need to change .withIds([1234]) to .withIds("1234"]).
  • If the script calls an entity's getStatsFor() method, you’ll need to change the call to getStats() and specify the date range using the selector's forDateRange() method.
  • If the script calls the keyword selector's withIds() method, make sure you pass only an array of keyword IDs. In Bing Ads, keyword IDs are unique, so there’s no need to pass an array of ad group ID and keyword ID pairs.
Note

If the script adds negative keywords with broad match type, Bing Ads converts them to phrase match type when adding them to the account. Bing Ads doesn't support broad match type for negative keywords.


For more information

Visit our documentation site for details on scripting:

See more videos...