August 17 2023

5 minutes of reading

Microsoft Advertising Scripts – what are they and how to start using them


Jakub Hajczuk

Microsoft Advertising Scripts are basically a JavaScript code that automatically creates, modifies, or deletes items in an ad account based on specific criteria. This allows multiple changes to be made simultaneously without the need for manual changes. These scripts allow you to perform automated activities at account, campaign, ad group, or keyword level.

These scripts are written in JavaScript and their implementation may require working with the API platform. JavaScript used by Microsoft Advertising Scripts is compatible with most ECMAScript ® 2015 specifications. However, bear in mind that browser-related functions such as DOM and API are not available, which means that we cannot use browser-related functions because the code is executed on Microsoft servers and not in the browser.

How do I start using Microsoft Advertising Scripts?

To begin using Microsoft Advertising Scripts, you need to meet several basic requirements and perform several steps:

  • Have/Set up an account in Microsoft advertising.

Before using Microsoft Advertising Scripts, you must have a Microsoft advertising account. To create a script, users can use the editor by selecting “Tools” and then selecting “Scripts” from the global menu at the top of the page.

See the screenshot from the MS addressing panel below

Source: Screen from MS Advertising panel

  • Have basic programming knowledge.

Microsoft Advertising Scripts are written in JavaScript, so you should have some basic programming knowledge. You can learn the basics of JavaScript programming here: Beginner’s Series are:JavaScript ¦ Microsoft Learn.

  • Task selection.

Before writing a script, select and develop the logic for solving the task to be automated. For example, you can automatically change the CPC rates based on selected criteria, disable low-performance keywords, or automatically resume stopped campaigns.

  • Script writing.

Once you have selected and developed the programming challenge you want to face, you can start writing your script. Use the available Microsoft advertising documentation, which contains many examples and ready-to-use solutions.

  • Script Deployment.

Once you have written your scripts, you need to implement and test them. This can be done by pasting scripts into the JavaScript console on the Microsoft advertising interface. The Microsoft advertising Scripting Editor allows you to preview how your script works, which is strongly recommended before you finally run it.

What is really curious is that you can send a Google script to Microsoft by simply pasting the copied script into the script editor in the Microsoft Ad Panel. When you select save, some changes will be made automatically to ensure compatibility with Microsoft. However, any compatibility problems that may arise will have to be corrected manually by updating the script.

Advantages of using Microsoft Advertising Scripts

  • A lot of time saved.

Microsoft Advertising Scripts helps you automate advertising activities, saving time and increasing performance. Instead of performing the same tasks manually, you can focus on more strategic activities.

  • Increased effectiveness of advertising activities.

Scripts make advertising more effective. Thanks to automatically changing bid rates or disabling low-performance keywords, your ads will better match your needs and expectations.

  • Optimized advertising costs.

By automating advertising, you can optimize advertising costs. Automatically disabling keywords with low efficiency or changing bid rates allows you to increase the number of conversions while reducing costs.

  • Possibility of using advanced functionalities.

Microsoft Advertising Scripts comes with advanced features such as disabling keywords based on data analysis or automatically resuming campaigns. This will surely improve the performance of your advertising activities.

  • Scalability.

Microsoft Advertising Scripts are designed to work with both small and large-scale campaigns, allowing advertisers to manage and optimize multiple accounts and campaigns simultaneously. This is particularly beneficial for companies wishing to expand their coverage and increase their presence on the Internet in a relatively short period of time.

Examples of Microsoft Advertising Scripts applications

Here are a few possible applications for Microsoft scripts:

  • Automatic change of CPC bid based on the hour and day of the week.

Thanks to Microsoft Advertising Scripts, you will automatically change CPC bids based on the time and day of the week. For example, you can set higher bids at peak times or weekends to better align advertising activities with your customers’ needs.

  • Automatic pause of low-efficiency keywords.

Scripts can automatically pause keywords that generate low conversion rates or high costs. This increases the efficiency of advertising and reduces costs.

  • Automatic resumption of stopped campaigns.

You will be able to automatically resume the campaigns that were recently stopped because the budget limit had been exceeded. This maintains the continuity of advertising activities and avoids the loss of potential customers.

  • Campaign performance analysis and report generation.

Microsoft Advertising Scripts analyze campaign performance and generate reports based on selected criteria so that you can monitor the effectiveness of advertising activities and make decisions based on specific data.

  • Automatic disabling of disapproved ads.

By using Microsoft Advertising Scripts, you can automatically disable disapproved ads that may affect the effectiveness of advertising activities. This will help you avoid the loss of potential customers and increase the effectiveness of advertising activities.

Microsoft Advertising Scripts vs. Google Ads Scripts – what’s the difference between them?

Microsoft Advertising Scripts and Google Ads Scripts serve similar purposes, i.e., automating and streamlining various tasks on appropriate advertising platforms. However, there are some differences between them.

  • Platform Compatibility.

The most obvious difference is the platforms on which they operate. Microsoft Advertising Scripts are intended for use with Microsoft advertising (formerly Bing ads), while Google Ads Scripts are intended for use with Google Ads.

  • Programming language.

Although both Microsoft Advertising Scripts and Google Ads Scripts use JavaScript as the primary script language, there may be slight differences in syntax and APIs. Advertisers should consult the relevant platform documentation to ensure effective implementation. Below is an example of scripts from both platforms pursuing the same objective. The scripts themselves differ somewhat in syntactical terms:

Get all campaigns. Example of a Microsoft script (1)

Get all campaigns. Google script example (2)

Get all Keywords in an ad group. Example of a Microsoft script (3)

Get all Keywords in an ad group. Google script example (4)

  • Properties and functionality.

Although both platforms offer similar opportunities, there may be differences in the specific properties and functionalities they provide. Google Ads Scripts, for example, have a larger library of built-in features, while Microsoft Advertising Scripts can offer certain unique features tailored to its platform. Advertisers should review the documentation for each platform to fully understand the options available.

  • Integration and support.

Depending on the third-party tools and services used by advertisers, the level of integration and support may vary between Microsoft Advertising Scripts and Google Ads Scripts. It is important that you assess how well the scripts of each platform integrate with the existing tools and systems to ensure trouble-free operation.

  • Integration with Google services.

Whenever we use Google services such as Google Drive, Sheets and Mail in script, authentication becomes necessary. There are different ways to set communication between services and Microsoft Advertising Scripts:

Option 1: Getting an access token from Google OAuth Playground.
Option 2: Get a refresh token from Google OAuth Playground.
Option 3: Obtain a refresh token using PowerShell script.

Below is a table summarizing the discussed differences:


To sum up, Microsoft Advertising Scripts and Google Ads Scripts offer similar functionalities but differ slightly in terms of programming language, tool availability, functionalities, documentation and support, as well as integration with other tools. The choice between these tools depends primarily on programming preferences and the specificities of advertising platforms. It is also worth adding that if someone has already used Google Ads Scripts, they will probably navigate Microsoft Scripts easily, as many concepts and structures are similar. All this means that the entry threshold for experienced people working with Google Ads Scripts may be lower, making it easier to move to Microsoft and use Microsoft scripts. 


(1) Code link:
(2) Code link:
(3) Code link:
(4) Code link:

Do you have any questions?

Do you want to deepen this topic? Write!
You liked the article, share it with:
May 10 2024
Google Ads Contact Form Extension - How We Increased the Quality of Leads
Jan Daszkiewicz
3 minutes of reading Clock icon
April 5 2024
E-commerce during Black Week: From Omnibus compliance to preparing estimates and advertising accounts
4 minutes of reading Clock icon

Let's change the world of e‑commerce together!

We're always happy when we can answer your questions. Feel free to contact us!