Microsoft Pixel Tracking for Shopify Plus

Create an Event-based Conversion Goal in Microsoft Ads

Tracking conversions is a crucial aspect of digital marketing. In this guide, we will walk you through the steps to create an event-based conversion goal in Microsoft Ads. This will allow you to track important actions, such as purchases, on your website. Follow the detailed instructions below to set up your conversion tracking effectively.

Why Use Event-based Conversion Goals?

Event-based conversion goals offer a precise way to track specific actions users take on your website. Unlike URL-based goals, which track page visits, event-based goals allow you to capture actions such as form submissions, button clicks, and product purchases. This granularity helps you understand user behavior better and optimize your campaigns for higher ROI.

Steps to Create the Conversion Goal

  1. In Microsoft Ads, go to Tools > Conversion Goals.
  2. Click Create Conversion Goal.
  3. For Conversion Goal, select Website.
  4. For Conversion Goal Type, select Purchase, then Event.

Note: From my support requests, in some cases using the destination URL option worked. So if your use case is one of those, try either events or destination URL, whichever works for you.

Configure Destination URL

To ensure that your conversions are tracked accurately, configure your Microsoft Ads conversion settings to track the destination URL. This is particularly useful if your conversion action redirects to a specific URL upon completion. Follow the steps below:

  1. In your Microsoft Ads account, navigate to the conversion goal you created.
  2. Change the tracking setting to Contains: processing?completed=true. This will track any URL containing this specific string.

Setup Tagging

Proper tagging is essential for tracking purchases accurately. In Microsoft Ads, configure the following settings:

  • Action: Purchase
  • Category: Checkout

When to Track This Event?

It's important to specify when you want to track the event. In this case, you should track events on inline actions, such as button clicks that do not lead to a page reload. This ensures that the purchase event is recorded as soon as it happens.

Add Custom Pixel to Shopify

To track conversions on your Shopify store, you need to add a custom pixel. Follow these steps to set it up:

  1. Log in to your Shopify backend.
  2. Go to Settings > Customer Events > Add Custom Pixel.
  3. Add the following code snippet and replace the placeholder ID with your actual Microsoft Ads tracking ID:

						(function(w,d,t,r,u){
							var f,n,i;
							w[u]=w[u]||[], 
							f=function(){
								var o={ti:"[REPLACE ID HERE]", enableAutoSpaTracking: true}; 
								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"); 
						
						analytics.subscribe('checkout_completed', (event) => { 
							window.uetq = window.uetq || []; 
							window.uetq.push('event', 'purchase', { 
								"event_category": "checkout", 
								"revenue_value": event.data.checkout.totalPrice.amount, 
								"currency": event.data.checkout.currencyCode, 
								"em": event.data.checkout.email, 
								"ph": event.data.checkout.phone, 
							}); 
						});
						

Testing Your Setup

After setting up your conversion tracking, it's important to test it to ensure it's working correctly. Here are some steps to test your setup:

  1. Complete a test purchase on your Shopify store.
  2. Check the conversion data in your Microsoft Ads account to see if the event is recorded.
  3. Use browser developer tools to inspect the network requests and verify that the tracking pixel is firing correctly.

Conclusion

Setting up event-based conversion goals in Microsoft Ads is an effective way to track important actions on your website. By following the steps outlined in this guide, you can ensure accurate tracking and gain valuable insights into user behavior. This, in turn, will help you optimize your ad campaigns for better performance and higher conversions.