How can I track conversions on Cart and Checkout pages with Google Tag Manager in Shopify?

sdlc_corp

SDLC Corp

Posted on August 1, 2024

How can I track conversions on Cart and Checkout pages with Google Tag Manager in Shopify?

To track conversions on Cart and Checkout pages with Google Tag Manager (GTM) on Shopify, follow these technical steps:

1. Set Up Google Tag Manager:

  • Create a GTM account and container if you haven't already.
  • Add the GTM container code to your Shopify store:
  • Go to Online Store > Themes > Actions > Edit Code.
  • Paste the GTM code snippet into the theme.liquid file, just before the closing tag.

2. Create Conversion Tracking Tags:

  • In GTM, create a new tag for conversion tracking (e.g., Google Analytics Event, Google Ads Conversion, etc.):
  • Go to Tags > New.
  • Select the appropriate tag type (e.g., Google Analytics: Universal Analytics).
  • Configure the tag with your tracking ID and relevant conversion parameters.

3. Set Up Triggers for Cart and Checkout Pages:

  • Create triggers to fire the tags on the Cart and Checkout pages:
  • Go to Triggers > New.
  • For the Cart page trigger:
  • Choose Page View as the trigger type.
  • Configure the trigger to fire on URLs containing /cart.
  • For the Checkout page trigger:
  • Choose Page View as the trigger type.
  • Configure the trigger to fire on URLs containing /checkout.

4. Add Data Layer Variables (if needed):

If you need to capture additional data (e.g., transaction values), ensure you push relevant data to the GTM data layer:

javascript
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'purchase',
'transactionId': '{{order.order_number}}',
'transactionTotal': '{{total_price}}',
'transactionProducts': {{line_items | json}}
});
</script>

Place this script in the appropriate locations within your Shopify checkout and order confirmation pages.

5. Test Your Tags and Triggers:

Use GTM’s Preview mode to test and verify that your tags and triggers fire correctly on the Cart and Checkout pages.
Ensure that the tags send the appropriate data to your tracking tool (e.g., Google Analytics).

6. Publish Your Container:

Once verified, publish the changes in GTM by clicking Submit and then Publish.

7. Verify Conversion Tracking:

Check your analytics or ad platform to ensure conversions are being tracked correctly.

Use tools like Google Analytics Real-Time reports to verify that events are being sent as expected.

By following these steps, you can effectively track conversions on your Shopify store’s Cart and Checkout pages using Google Tag Manager.

For additional assistance with Shopify-related queries, consider reaching out to Shopify development experts at SDLC Corp.

💖 💪 🙅 🚩
sdlc_corp
SDLC Corp

Posted on August 1, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related