How to Setup Microsoft Ads (Bing) Dynamic Remarketing on Shopify
Intro
Dynamic remarketing on Microsoft Ads is an important and effective tool for promoting an online store. However, setting up all the necessary parameters for dynamic remarketing isn’t a facile issue and requires some non-trivial additional settings.
Our article will help you to set up everything you need for your online store on Shopify so you could work with dynamic remarketing on Microsoft Shopping Ads (Bing Shopping Ads).
All of these data are tracked and sent with the help of additional scripts. Our instruction also contains a modified version of the Microsoft Ads (Bing) Purchase Goal Tag for sending transaction value data.
Let’s set up Microsoft Dynamic Remarketing set by step.
Create a Dynamic Remarketing Audience in Microsoft Ads Account
The first step — create your dynamic remarketing audience in the audience section on your Microsoft Ads account. To do this, follow the “Audience” menu and find the Create audience button.

Set the name of the audience and select the type of audience you want to create: Dynamic remarketing list.

From the “Tag name” drop-down list, select the tag you want.

Select one of the 5 available dynamic audience types:
- General visitors — “home”, “category” and “other” pages visitors;
- Product searchers — “searchresults” pages visitors;
- Product viewers — “product” page visitors;
- Shopping cart abandoners — “cart” page visitors;
- Past buyers — “purchase” page visitors — your thankyou page visitors.
Past buyers’ audiences will be excluded from other audiences automatically.
Don’t forget to include the time period for the audience from 1 to 180 days.
You will see the UET tag for placing on the site in a special window, at the end of the page.

This code includes 3 parts:
- Main Microsoft UET tag. This part contains the unique ID of your UET tag.
- This code part sends additional parameters. It won’t work as-is, it needs to be personalized.
- UET tag comment: the optional part of the code. You may not implement it on the site. But if you choose not to use it, don’t forget the closing tag </script> — any code doesn’t work without that.
The first part of the code you may use without changes.
Instead of the second part, the modified variant below should be used.
window.uetq = window.uetq || [];
window.uetq.push('event', '',
{'ecomm_prodid': {% if template contains 'product' -%}
'shopify_US_{{ product.id }}_{{ product.selected_or_first_available_variant.id }}'
{%- elsif template contains 'collection' -%}
[{% for item in collection.products limit:3 %}'shopify_US_{{ item.id }}_{{ item.selected_or_first_available_variant.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
{%- elsif template contains 'index' -%}
[{% for item in collection.products limit:3 %}'shopify_US_{{ item.id }}_{{ item.selected_or_first_available_variant.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
{%- elsif template contains 'search' -%}
[{% for item in search.results limit:3 %}'shopify_US_{{ item.id }}_{{ item.selected_or_first_available_variant.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
{%- elsif template contains 'cart' -%}
[{%- for item in cart.items limit:3 -%}'shopify_US_{{ item.product_id }}_{{ item.variant_id }}'
{%- unless forloop.last -%}, {%- endunless -%}
{%- endfor -%}]{%- endif -%},
'ecomm_pagetype': '{% if template contains 'index' %}home{% elsif template contains 'collection' %}category{% elsif template contains 'search' %}searchresults{% elsif template contains 'product' %}product{% elsif template contains 'cart' %}cart{% elsif template contains 'purchase' %}purchase{%endif %}', });
This code will pass dynamic product IDs and website page types to the ecomm_prodid and ecomm_pagetype attributes. This code is preset to pass Product IDs in shopify_US_xxxxxxxxxxxxxxx format.
There are three other variants of the size:
- SKU — the SKU code value (combines letters and numbers, e.g. aga-012) is sent instead of the product ID;
- variant-id — a unique identifier of the product variant (numeric number, for example, 21283160948841);
- product-id_variant-id — unique identifier of the product and product variant (two numbers with an underscore, for example, 28541777444969_21283160948841).
The last option is rarely used, usually, a prefix is added to the numbers, such as — shopify_US – in our case. US is an alphabetic code of the feed’s country.
If you have a Product ID in SKU format in your feed, replace the lines of code highlighted in yellow above with:
'{{ product-id-prefix }}{{ product.selected_or_first_available_variant.sku }}'
[{% for item in collection.products limit:4 %}'{{ product-id-prefix }}{{ item.selected_or_first_available_variant.sku }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
[{% for item in collection.products limit:4 %}'{{ product-id-prefix }}{{ item.selected_or_first_available_variant.sku }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
[{% for item in search.results limit:4 %}'{{ product-id-prefix }}{{ item.selected_or_first_available_variant.sku }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
[{%- for item in cart.items limit:4 -%}'{{ product-id-prefix }}{{ item.sku }}'
If you have a Product ID in variant_id format in your feed, replace the lines of code highlighted in yellow above with:
'{{ product-id-prefix }}{{ product.selected_or_first_available_variant.id }}'
[{% for item in collection.products limit:4 %}'{{ product-id-prefix }}{{ item.variants.first.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
[{% for item in collection.products limit:4 %}'{{ product-id-prefix }}{{ item.variants.first.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
[{% for item in search.results limit:4 %}'{{ product-id-prefix }}{{ item.variants.first.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
[{%- for item in cart.items limit:4 -%}'{{ product-id-prefix }}{{ item.variant_id }}'
If you have a Product ID in product-id_variant-id format in your feed, replace the lines of code highlighted in yellow above with:
'{{ product-id-prefix }}{{ product.id }}_{{ product.selected_or_first_available_variant.id }}'
[{% for item in collection.products limit:3 %}'{{ product-id-prefix }}{{ item.id }}_{{ item.selected_or_first_available_variant.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
[{% for item in collection.products limit:3 %}'{{ product-id-prefix }}{{ item.id }}_{{ item.selected_or_first_available_variant.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
[{% for item in search.results limit:3 %}'{{ product-id-prefix }}{{ item.id }}_{{ item.selected_or_first_available_variant.id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
[{%- for item in cart.items limit:3 -%}'{{ product-id-prefix }}{{ item.product_id }}_{{ item.variant_id }}'
If you are not sure which Product ID you need, check out the last section of this manual.

Put Bing UET Dynamic Remarketing Audiences Tag To All Shopify Pages
Go to your Shopify account.
In the left menu select the “Online Store”, then go to the “Themes” section (1). In the drop-down menu “Actions” (2), select “Edit Code” (3).

In the “Layout” folder find the snippet named theme.liquid and open it.

Put the code of the UET tag in the opened code window. Place a second personalised part of the code between the <head> and </head> tags. Save your changes.
Put a Microsoft UET Dynamic Remarketing Tag On the Shopify Cart Page
Before continuing with the instructions on Microsoft Dynamic Remarketing tag placing on the cart, you should also know about creating for purchase conversion and placing the tag on the cart. If you already set up a purchase conversion with dynamic value tracking, go to the next step.
Set Up a UET Purchase Conversion With Dynamic Value Tracking For Bing Shopping
Follow the next steps:
1. Set up conversion goal on the Microsoft Ads account, in the “Conversion goals” section

2. Fill the conversion name field and select conversion type: Event

3. Fill the Action field and select Goal category: Purchase

4. Select “Conversion action value may vary…” and fill the default value.

5. Select how you prefer to count conversions: all or unique. Correct conversion window if you need.
6. At the end of the page, you will see the UET tag script code. This code needs to be refined and placed in the Shopify shopping cart.

- Main UET tag. It contains a unique ID of your UET tag.
- Part of the code tracks info about the purchase with dynamic parameters value. You need to replace this part with the code below:
window.uetq = window.uetq || [];
window.uetq.push('event', 'purchase',
{'revenue_value': {% if price-decimal-fs == true -%}{{ checkout.total_price | money_without_currency | remove: ',' }}{% else %}{{ checkout.total_price | money_without_currency | remove: '.' | replace: ',', '.' }}{%- endif -%},
'currency': 'USD'});
</script>
This tag contains the event name set in the Action field in Step 3 of conversion creation
(window.uetq.push('event', 'purchase')
The conversion value and currency are also dynamically transmitted. If you use a different currency on the site, replace the USD value with the letter code of the desired currency.
Place a UET tag on your Shopify shopping cart.
To do this, go to the Settings section (1) and select Checkout (2).

Place tag on Additional scripts section.
The final UET tag on the Shopify cart that tracks purchase events and values will look like this:
<script>
(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:"56290063"};o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq");
window.uetq = window.uetq || [];
window.uetq.push('event', 'purchase',
{'revenue_value': {% if price-decimal-fs == true -%}{{ checkout.total_price | money_without_currency | remove: ',' }}{% else %}{{ checkout.total_price | money_without_currency | remove: '.' | replace: ',', '.' }}{%- endif -%},
'currency': 'USD'});
</script>
Put a Microsoft Ads Dynamic Remarketing Tag on the Shopping Cart Page
Place the tag below under the conversion tag from the previous step. This tag tracks and sends dynamic remarketing parameters:
<!-- Event snippet for Bing Dynamic Remarketing -->
<script>
window.uetq.push('event', '', {
'ecomm_prodid': [{% for item in checkout.line_items limit:3 %}'shopify_US_{{ item.product_id }}_{{ item.variant_id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}],
'ecomm_pagetype': 'purchase'});
</script>
Correct code for your Product ID format, if you need:
1. If you have SKU Product ID format, replace the lines of code highlighted in yellow above with:
[{% for item in checkout.line_items %}'{{ product-id-prefix }}{{ item.sku }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
2. If you have variant_id Product ID format, replace the lines of code highlighted in yellow above with:
[{% for item in checkout.line_items %}'{{ product-id-prefix }}{{ item.variant_id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
3. If you have product-id_variant-id Product ID format, replace the lines of code highlighted in yellow above with:
[{% for item in checkout.line_items limit:3 %}'{{ product-id-prefix }}{{ item.product_id }}_{{ item.variant_id }}'{% unless forloop.last %}, {% endunless %}{% endfor %}]
Save changes.
The final full tag on the Shopify shopping cart

- Main UET tag. It contains a unique ID of your UET tag.
- Part of the code tracks info about the purchase with dynamic parameters value.
- The code that passes values for dynamic remarketing parameters: Product ID and page type.
How to Check & Track UET Tags Using Bing Tag Assistant?
If the UET tag code is implemented correctly, your UET tag will get an active status in the UET tag section of Microsoft Ads.

If the dynamic remarketing parameters track correctly, the dynamic remarketing audiences will begin to accumulate data.

It’s important to note that statistics by the quantity of users within audiences can take a long time to accumulate. It depends on the volume of traffic to each audience. It is especially true for the “Cart Abandoned” and “Past Buyers” audiences. While the statistics are accumulating, the size value of these audiences will be 0. In our case, statistics for these audiences began to be displayed after 30 users had accumulated in the search network audience only.
To check if Product ID and Page type values are passed to dynamic remarketing attributes correctly, install the UET Tag Helper browser extension.
Launch the extension, open your website and activate the extension on the site. In the Tracking Code section, check out parameters that are replaced dynamically.

To check whether tags are triggered on your “Thank you page” after purchase, go to the Order section in your Shopify account. Select an order and click on it.

On the order, page find More actions bar (1) and select View order status page (2).

A new window will open the thank you page for this order. On that page, press Ctrl+U and find the UET tag code. The easiest way to do this is to search for the unique identifier of your UET tag.

If your code works correctly, you will see the correctly replaced values for Product ID and Page type. Also, the revenue value will be replaced correctly.
How to Understand What Product ID Format is Used in Your Microsoft Product Feed
Product ID format is often set at the level of the application which creates the product feed on Shopify.
If you use Feed for the Google Shopping application (we recommend it) you may check Product ID there.
In the application, find Settings and select Bing Shopping Settings. Here you can find your feed Product ID format.

Now you know all about how to set up dynamic remarketing. Don’t hesitate to ask your questions in the comment section, we’ll be happy to answer them!
If you want us to help you with the setup, contact us.
To find out more about Setting Up Microsoft Shopping Campaigns (Bing Ads) For E-Commerce Store On Shopify, read this article.

Xenia Volokitina
Performance Marketing Specialist. Working with PPC since 2016. Specializes in Google & Microsoft paid traffic for eCommerce & B2B projects. In love with analysis. When not launching effective Ad campaigns, she is reading up on the latest in eCommerce and data tracking last trends.