Microsoft Ads Scripts:
A Hidden Gem of Digital Marketing

Microsoft Advertising offers an attractive option in digital marketing that extends beyond its own search engine, Bing. By being able to integrate with other Microsoft products and partners, such as Yahoo and AOL, its ads reach a diverse audience that does not always overlap with Google’s.

Although Microsoft Advertising handles a smaller search volume compared to Google, its ads often have a lower cost per click (CPC) and, in some markets and sectors, a higher conversion rate. Its audiences are mature and have high purchasing power, especially relevant for the B2B sector, where these characteristics are crucial. Moreover, with the recent integration in Bing of its version of the GPT chat artificial intelligence, an expansion of its market share in the coming years, even months, is expected.

However, managing Microsoft Ads campaigns presents a greater challenge than those of Google, mainly due to the poor performance their Smart Bidding campaigns still exhibit. This elevates the value of alternative bidding systems and the strategic use of scripts.

Microsoft Ads scripts are, as of the beginning of 2024, light years away from what Google Ads offers, yet their importance cannot be understated. Their ability to customize and automate campaign management opens new avenues for optimizing performance and effectively reaching key audiences, which makes them one of the hidden gems of digital marketing.

What are Microsoft Ads Scripts?

A script is a piece of code written in JavaScript that allows for automating tasks and operations within the Microsoft Advertising platform. Scripts are used to modify bids, pause or activate campaigns, ad groups, and keywords, generate custom reports, and make bulk changes.

Microsoft Ads scripts began to be available in a beta version at the end of 2018, which is why they have not reached the level of sophistication of Google Ads scripts, which have been in development since 2012.

Differences between Microsoft and Google scripts

When tackling the creation of a script in Microsoft, we must consider some essential points.

The number of options is much more limited in Microsoft than in Google. For example, with Microsoft scripts, it is not possible to obtain a report of the search terms of the account at any level (ad group, campaign, or account). Therefore, it is crucial to dive into the information that Microsoft offers to ensure that what we intend to do can be done.

On the page Microsoft Advertising Scripts Overview all information related to the scripts is incorporated. To see what entities can be used, you can go to the Script reference -> Single account section.

On the same page, links to code examples for working with keywords, ad groups, campaigns, etc., are included, which can be very useful.

Another fundamental difference for those of you who are users of Google scripts is that in Microsoft, Queries to obtain information are not available. All database queries must be made through Iterators.

On the other hand, Microsoft Ads scripts are oriented more than anything to reporting and the automation of very simple account management tasks. For more complex tasks or to act on more complex account parameters, it is necessary to resort to using the API.

To access Google services like Google Drive, Sheets, and Email from scripts, it is necessary to obtain credentials through the API and add specific functions in the code that facilitate access to these Google tools.

Instructions for obtaining credentials (there are several steps but the documentation is very precise and it is possible to obtain the credentials even without prior knowledge of the necessary tools):

https://learn.microsoft.com/en-us/advertising/scripts/examples/authenticating-with-google-services

(We recommend option 2 or 3 to obtain the refresh token)

Example from the official Microsoft Ads documentation that shows how to use Google services such as Google Drive, Sheets, and Email.

It is also important to keep in mind that Microsoft’s support and consultation forum is nothing like Google’s. Assistance and resources are going to be very scarce. You will have to learn step by step, relying essentially on your ability to navigate out of the inevitable dead ends that always appear.

What can Microsoft Ads Scripts do?

With Microsoft Ads scripts, we can perform a multitude of simple tasks. But we should not be discouraged by the apparent simplicity of the available actions, complex and effective scripts can be generated by combining these tasks.

At Fáktica Analytics, for example, we have created a script for Microsoft Ads that adjusts the bids of thousands of keywords daily to optimize their net performance.

In the official documentation, you can find code examples for:

  • Obtaining or adding a keyword to a campaign or ad group. Pausing it, updating its bid value, or obtaining its main KPIs. Here.
  • Obtaining all ad groups, pausing them, or obtaining performance data. Here.
  • Adding, obtaining, or pausing ads. Here.

Let these cases serve as examples. You can find many others available on the official page.

Although the selection is not extensive, a couple of interesting scripts can be found on GitHub:

Report the cost of Bing Ads campaign from the last week in Google Sheet:

https://gist.github.com/tbrzica/bec52b8a17fa05988af414e712676b31

Create a report in Google Sheet containing Impressions, Clicks, Cost, and Conversions from yesterday for your Bing Ads campaigns:

https://gist.github.com/krsoninikhil/30f5b0339c3c7f35645dff1713674473

How to install a Script

These are the instructions that appear on the Microsoft Ads page. We include some screenshots to make them more understandable, although, in reality, there is no difficulty.

  1. Log in to Microsoft Advertising.
  2. In the global menu at the top of the page, select Tools > Scripts.
Faktica Tools scripts

3. Select Create script.

create

4. Replace “Untitled Script” with the name of the script.

5. Copy and paste the script code.

edit

To run the script in preview mode (recommended), select “Preview.”

To view the output after the script or the preview has been run, select “Logs.”

The difference between “Preview” and “Run script now” is that the preview offers the opportunity to see how the script would affect the data without actually making any changes.

Now, all that’s left is to start programming scripts in Microsoft Ads and watch your campaigns take off while you dedicate your time to more rewarding tasks. If you need help with the scripts, don’t hesitate to contact us without obligation.

MOST RECENT ARTICLES

Scroll to Top

Can We Help You?

Included by Google in the Top 3% of Spanish PPC agencies
Neotec-CDTI-logo
Subsidized by the CDTI in 2021-2023.

FÁKTICA ANALYTICS

Calle Núñez de Balboa, 35A

28001 Madrid

Spain

 

DATALYTICS

4 Portland Ct

St. Louis, MO 63108

USA

Contact: info@faktica.com
Can We Help You?

Ask Us for a No-Obligation Quote

Request a Traffic, Cost, and Potential Conversions Estimate

Ask About Our Pay-for-Performance Pricing

Get a Free Opportunities Analysis

Can We Help You?

Don’t hesitate to reach out to us