Maximizing Google Ads Success for Shopify Stores: A Comprehensive Guide on View Item Conversion Tracking

by ShahzadaAliHassan - 19th December 2023

Introduction

In the dynamic world of digital marketing, tracking view item conversion actions in Google Ads plays a pivotal role in understanding customer interactions with your Shopify store. This detailed guide outlines how to write a data layer script for Google Tag Manager (GTM) to track these actions and how to integrate them with Google Ads for specific campaigns.

Importance of Tracking View Item Conversions

Tracking view item conversions is crucial for several reasons:

  1. Enhanced Ad Performance: It helps Google Ads to identify which products are gaining attention, enabling more targeted and effective advertising.
  2. Data-Driven Decisions: Understanding customer preferences and behaviors leads to more informed marketing and inventory decisions.

Step 1: Setting Up Google Tag Manager on Shopify

Verifying GTM Firing on Shopify

Before diving into conversion tracking, it's essential to ensure that GTM is firing correctly on your Shopify store:

  1. Access GTM Container ID: In your GTM dashboard, click on your container ID to view the head and body tracking scripts.
  2. Integrating Scripts on Shopify:
    • Navigate to the 'Online Store' section of your Shopify dashboard.
    • Go to 'Themes', click 'Actions', and then 'Edit Code'.
    • Locate the <head> tag and paste the GTM head script.
    • Find the opening <body> tag (use Ctrl + F for convenience) and paste the GTM body script.
  3. Save Changes: Format the code, save the file, and verify the script’s functionality on your store.

Step 2: Writing the Data Layer Script for View Item Event

This set of code snippets is responsible for managing the initialization and population of the dataLayer object on a Shopify website. It ensures that relevant data is accurately captured and made available for tracking and analytics purposes.

Initializing the DataLayer

To begin, we have a code snippet designed to initialize the dataLayer array if it hasn't been initialized already. It also includes logic to identify whether the current page template corresponds to a 'product' page. If so, it triggers the rendering of a specific snippet called 'datalayer-product'.

Capturing Product Data

The primary focus of the 'datalayer-product' snippet is to capture essential product information when a user visits a product page. Here's how it works:

  1. It identifies and captures the current product variant.
  2. Constructs an itemObject that holds various product details.
  3. Upon document load, it pushes this data into the dataLayer object.

Integrating Theme DataLayer Code

Lastly, to integrate the theme-level dataLayer code, you need to render the 'head-datalayer' snippet. Depending on your Shopify theme setup, this is where the head datalayer code typically resides. You should insert this code into the GTM Body Code section.

Steps to Implement DataLayer Code in Shopify:

  1. Backup: Always start by creating a backup of your current theme.

  2. Access Theme Files: Log in to your Shopify Admin, go to Online Store > Themes, and select "Edit code" from the "Actions" dropdown for your live theme.

  3. Adding Head DataLayer Code: In the left sidebar, find and click on theme.liquid. Place the "Head DataLayer Code" snippet within the <head> tags.

  4. Adding Product DataLayer Code: Create a new snippet (name it datalayer-product.liquid, if needed), and insert the "Product DataLayer Code" snippet into it. Save your changes.

  5. Integrate Theme DataLayer Code: Determine the desired location within the <head> tags in theme.liquid for the "Theme DataLayer Code" snippet. Insert it accordingly. Save your changes.

  6. Testing: Visit a product page on your Shopify store, open the browser's developer console, and verify that the custom_view_item event is triggered and that the dataLayer object contains the accurate product details.

These steps ensure that your Shopify website effectively captures and utilizes data for tracking and analytics purposes.

Step 3: Configuring Tags in Google Tag Manager for Enhanced View Item Tracking

Configuring tags in Google Tag Manager (GTM) is a crucial step in leveraging the full potential of view item conversion actions in your Shopify store's Google Ads campaigns. This detailed guide walks you through creating a custom view item event, setting up the necessary tags, and ensuring that these changes are effectively published in GTM.

Creating Custom View Item Event

Trigger Creation: Crafting the Custom View Item Event

The first step in GTM is to create a trigger that corresponds to the custom view item event. This trigger is essentially the condition that will activate the tag. For a Shopify store, this event is triggered when a potential customer views a product.

  1. Access GTM: Log in to your Google Tag Manager account and select the appropriate container.
  2. New Trigger: Click on 'Triggers' in the GTM interface, followed by 'New'.
  3. Trigger Configuration:
    • Choose 'Custom Event' as the trigger type.
    • Name your trigger descriptively, like 'View Item Trigger'.
    • In the event name field, enter the event name that matches the event in your data layer script, such as 'view_item'.
    • Set the trigger to fire on 'All Custom Events' or define specific conditions if needed.

This process establishes a direct link between the user action on your Shopify store and the tag that will be activated in response.

Setting Up Tags: Integrating with Google Ads

After setting up the trigger, the next step is to configure the tags that will send data to Google Ads when the trigger is activated.

  1. Configure Google Ads Conversion Tracking Tag:

    • Go to 'Tags' in GTM and create a new tag.
    • Select 'Google Ads Conversion Tracking' as the tag type.
    • This tag will be responsible for sending conversion data to Google Ads every time a product view occurs.
  2. Utilizing Conversion ID and Label from Google Ads:

    • In Google Ads, navigate to the 'Conversions' section under 'Tools & Settings'.
    • Find the conversion action created for 'custom_view_item' and note the conversion ID and label.
    • Back in GTM, input these details into the corresponding fields in the tag configuration.
  3. Define Conversion Values Based on Product Price and Currency from the Data Layer:

    • This step involves mapping the product price and currency to the conversion value.
    • Use the 'Variable' feature in GTM to create new variables that pull product price and currency data from the data layer.
    • Assign these variables to the conversion value and currency fields in the tag setup.
    • This ensures that each view item event carries its unique value, reflecting the actual product viewed.

Publishing Changes in GTM: Activating Your Configuration

The final step in this process is to ensure that all changes made in GTM are saved and published. This action makes your configurations live, allowing data to flow from your Shopify store to Google Ads.

  1. Save Your Work:

    • After configuring your tags and triggers, click 'Save' on each configuration panel.
    • Review all settings to ensure accuracy.
  2. Publishing the Container:

    • In the GTM interface, navigate to the 'Submit' button at the top right corner.
    • This step opens a new window where you can name the version of the container you're publishing. For instance, 'View Item Event Tracking'.
    • Optionally, add a description to document the changes made in this version.
    • Click 'Publish' to make your configurations active.
  3. Verify Implementation:

    • Post-publishing, it's vital to verify that the tags are firing correctly.
    • Use GTM's 'Preview' mode to test the tag firing on your Shopify store.
    • Visit a product page on your store and check if the 'custom_view_item' event is triggering the tag.
    • You can also use tools like Google Tag Assistant to verify the tag's functionality.

Step 4: Creating Conversion Actions in Google Ads

Creating conversion actions in Google Ads is a crucial step in the process of tracking and enhancing the effectiveness of your online advertising. This step involves a detailed setup within Google Ads and integration with Google Tag Manager (GTM) to ensure accurate tracking of user interactions with your Shopify store. Let’s delve deeper into each aspect of this process.

Setting Up Conversion Action

1. Navigating to Google Ads

2. Creating a New Conversion Action

3. Custom Event Setup

4. Conversion Value and Count Settings

Integrating with Google Tag Manager

1. Obtaining Conversion ID and Label from Google Ads

2. Tag Configuration in GTM

Finalizing and Testing

Step 5: Applying Conversion Actions to Specific Campaigns

In the realm of digital advertising, the integration of conversion actions into specific campaigns is a critical step for enhancing the effectiveness of your Google Ads strategy. This section delves deeply into the process of linking your meticulously crafted conversion actions, specifically the 'custom_view_item' action, to your individual campaigns within Google Ads.

Linking to Campaigns

1. Verify Conversion Action in Google Ads

Before integrating the conversion actions with your campaigns, it’s paramount to ensure that these actions are correctly set up and recognized by Google Ads.

2. Assigning to Campaigns

Once the conversion action is verified and active, the next step is to assign this action to specific campaigns in your Google Ads account.

Conclusion

By following these steps, you’ll successfully track view item conversions in your Shopify store. This enables better-targeted campaigns and more efficient ad spending in Google Ads. Remember, continuous monitoring and tweaking are essential for optimal performance. Keep learning and evolving your strategies for the best results in your e-commerce journey.