How to Use GTM DataLayers to Improve LinkedIn Conversion Tracking for Your Shopify Store

LinkedIn is one of the most effective social media sites for reaching professionals and potential customers. So, if you’re running a Shopify store, it’s important to have a solid LinkedIn conversion tracking strategy in place to keep tabs on how your advertising efforts are panning out. Fortunately, with a few simple tweaks and the help of Google Tag Manager (GTM) data layers, you can easily optimize your LinkedIn conversion tracking for maximum return on investment (ROI).

First, let’s define what a data layer is. In short, a data layer is a JavaScript object that stores information about a website. This information is then passed on to tags in GTM, which can then be used to track conversions and other important analytics data.

Now, let’s get started with how to set up your GTM data layer for LinkedIn conversion tracking. Here are the steps you need to follow:

Step 1: Set up your LinkedIn conversion tracking pixel

Before you can start using GTM data layers to track conversions, you need to set up your LinkedIn conversion tracking pixel. This is a small piece of code that you add to your Shopify store’s checkout page or any other page where conversions take place. Once you’ve installed the pixel, LinkedIn will be able to track conversions on your site and send that data to your LinkedIn Ads account.

Step 2: Create your GTM Data Layer variables

Next, you’ll need to create your GTM data layer variables. Instead of using hard-coded values, you can use dynamic values fetched from your Shopify store using Shopify’s Liquid template language. Here’s an example of a data layer variable you could use to track product purchases with dynamic values:

{
'event': 'purchase',
'ecommerce': {
'purchase': {
'actionField': {
'id': '{{ order.order_number }}',
'affiliation': 'Shopify Store',
'revenue': '{{ order.total_price }}',
'tax': '{{ order.total_tax }}',
'shipping': '{{ order.shipping_lines[0].price }}',
'coupon': '{{ order.discount_codes[0].code }}'
},
'products': [{% for line_item in order.line_items %}
{
'name': '{{ line_item.title }}',
'id': '{{ line_item.product_id }}',
'price': '{{ line_item.price }}',
'brand': 'Your Brand Name',
'category': '{{ line_item.product.type }}',
'variant': '{{ line_item.variant.title }}',
'quantity': {{ line_item.quantity }}
},
{% endfor %}]
}
}
}

The above code creates a data layer variable called ‘purchase’. This variable is used to track product purchases and includes information about the purchase, including the revenue, tax, and shipping.

Step 3: Create your GTM Tag

Once you’ve created your data layer variable, you’ll need to create a GTM tag to track the conversion. Here’s an example of a GTM tag that you can use to track product purchases with dynamic values:

<script>
dataLayer.push({
'event': 'purchase',
'ecommerce': {
'purchase': {
'actionField': {
'id': '{{ order.order_number }}',
'affiliation': 'Shopify Store',
'revenue': '{{ order.total_price }}',
'tax': '{{ order.total_tax }}',
'shipping': '{{ order.shipping_lines[0].price }}',
'coupon': '{{ order.discount_codes[0].code }}'
},
'products': [{% for line_item in order.line_items %}
{
'name': '{{ line_item.title }}',
'id': '{{ line_item.product_id }}',
'price': '{{ line_item.price }}',
'brand': 'Your Brand Name',
'category': '{{ line_item.product.type }}',
'variant': '{{ line_item.variant.title }}',
'quantity': {{ line_item.quantity }}
},
{% endfor %}]
}
}
});
</script>

The above code creates a GTM tag that’s linked to your ‘purchase’ data layer variable. You can use this tag to track the purchase conversion on your Shopify store.

Step 4: Add additional tracking events

While the examples provided above focus on tracking product purchases, you can also add more events to track other conversion actions such as form submissions, newsletter sign-ups, or even page views. This will give you a more comprehensive view of how your LinkedIn ads are performing across various conversion points in your Shopify store.

Step 5: Test and Publish

After you’ve set up your GTM data layer and tag, be sure to test it to make sure it’s working correctly. You can do this by previewing and debugging your GTM container to see if the data is being passed on to LinkedIn.

Once you’ve confirmed that everything is working correctly, you can publish your tag and start tracking your LinkedIn conversion data.

In conclusion, using GTM data layers to improve LinkedIn conversion tracking for your Shopify store is a relatively easy process that can provide valuable insights into your advertising efforts. By following the above steps and tweaking the code to suit your own sales goals, you can start seeing improved ROI and more successful social media campaigns in no time.