How to Set Up Google Tag Manager and Track Add to Cart Conversion Actions on Your WooCommerce Store

by ShahzadaAliHassan - 26th July 2024

In this guide, you'll learn how to set up tracking for the "Add to Cart" event on your WooCommerce store using Google Tag Manager (GTM) and Google Ads. By following these steps, you can optimize your advertising campaigns by understanding user behavior on your site.

Table of Contents

  1. Introduction
  2. Ensuring Proper Access
  3. Installing GTM Plugin on WordPress
  4. Verifying GTM Container Installation
  5. Creating Conversion Action in Google Ads
  6. Enabling Data Layer in WooCommerce
  7. Testing Add to Cart Event
  8. Setting Up Conversion Linker Tag
  9. Creating Custom Event Trigger
  10. Adding Google Ads Conversion Tracking Tag
  11. Creating Remarketing Tag
  12. Final Testing and Verification
  13. Publishing Changes
  14. Conclusion

Introduction

By the end of this guide, you'll be able to track the "Add to Cart" event on your Google Ads account for your WooCommerce store using Google Tag Manager. This will help you see which users are adding items to their cart and what those items are.

Ensuring Proper Access

  1. WordPress:

    • Go to the back end of your WordPress site.
    • Click on "Users" and find your email address.
    • Ensure you have administrator access.
  2. Google Tag Manager:

    • Open your GTM container.
    • Click on "Admin," then "User Management."
    • Ensure your email has publish access to the container.
  3. Google Ads:

    • Go to your Google Ads account.
    • Navigate to "Admin" and click on "Access and Security."
    • Verify you have either standard or admin access.

Installing GTM Plugin on WordPress

  1. Add GTM Plugin:

    • Go to your WordPress backend, click on "Plugins," then "Add New."
    • Search for "GTM for WP" by Thomas Geiger.
    • Install and activate the plugin.
  2. Configure GTM Plugin:

    • Navigate to the plugin settings.
    • Enter your GTM container ID (found in GTM under "Admin").
    • Save changes. Ensure the container code is on and save again if needed.

Verifying GTM Container Installation

  1. Use GTM Preview Mode:

    • Go to your GTM account, click on "Workspaces," then "Preview."
    • Connect the debug session to your website to check if tags are firing correctly.
  2. Google Tag Assistant Chrome Extension:

    • Install the extension and check if the GTM container is firing properly.

Creating Conversion Action in Google Ads

  1. Create Conversion Action:

    • Go to your Google Ads account, click on "Goals," then "Summary."
    • Click the plus button to create a new conversion action.
    • Select "Website" and enter your website URL.
  2. Configure Conversion Action:

    • Create a manual action named "Add to Cart."
    • Set it to track dynamic values and save.

Enabling Data Layer in WooCommerce

  1. Enable WooCommerce Events:
    • In your WordPress backend, go to the GTM plugin settings.
    • Click on the "Integration" tab, then "WooCommerce."
    • Enable "Track e-commerce events" and "Clear previous object before new event."
    • Save changes.

Testing Add to Cart Event

  1. Test the Event:
    • Go to your WooCommerce product page.
    • Click "Add to Cart."
    • In the GTM debug window, verify that the "Add to Cart" event is firing.

Setting Up Conversion Linker Tag

  1. Add Conversion Linker Tag:
    • In GTM, go to "Tags," click on "New," and select "Conversion Linker."
    • Set it to fire on all pages and save.

Creating Custom Event Trigger

  1. Create Custom Event Trigger:
    • Create a new trigger with a custom event named "Add to Cart."
    • Configure the necessary variables: value, currency, and items array.

Adding Google Ads Conversion Tracking Tag

  1. Set Up Conversion Tracking Tag:
    • Create a new tag for Google Ads Conversion Tracking.
    • Use the conversion ID and label from your Google Ads account.
    • Configure the tag to fire on the "Add to Cart" event.

Creating Remarketing Tag

  1. Add Remarketing Tag:
    • Create a new tag for Google Ads Remarketing.
    • Configure it with the conversion ID and label, and set it to fire on the "Add to Cart" event.

Final Testing and Verification

  1. Use GTM Preview Mode:

    • Open the debug window and test the "Add to Cart" event on your WooCommerce site.
    • Verify that the conversion tracking and remarketing tags are firing correctly.
  2. Check Tag Assistant:

    • Ensure the Google Ads tag is firing and the event data is accurate.

Publishing Changes

  1. Submit GTM Container:
    • In GTM, click on "Submit" to publish your changes.
    • Name the version and describe the changes made.

Conclusion

By following these steps, you'll have successfully configured the "Add to Cart" event tracking for your WooCommerce store using GTM and Google Ads. This setup will help you track important conversion actions and optimize your ad campaigns effectively. If you want to learn how to track the "View Item" event, click here.