by ShahzadaAliHassan - 12th December 2023
In this Blog , we'll explore how to effectively integrate TikTok Pixel InitiateCheckout Event with your Shopify store using Google Tag Manager (GTM). This integration is crucial for leveraging TikTok's dynamic ad capabilities based on user interactions on your site.
Initial Steps for Integrating Google Tag Manager with Shopify
Begin by integrating Google Tag Manager (GTM) into your Shopify store. This is a crucial step for monitoring and analyzing customer interactions.
Proceed to embed the GTM scripts in your Shopify store. These are fundamental for capturing and analyzing user data.
The following steps involve implementing GTM container scripts in your Shopify theme:
<head>
tag.<body>
tag, place the GTM container's body script.Ensure to check your setup post-implementation, confirming that GTM operates correctly on your Shopify site.
To confirm correct setup, utilize GTM's preview feature. This helps verify the container's activation on your Shopify store, essential for subsequent Analytics and Ads tracking.
Note Replace 'GTM-XXXX' with your specific GTM container ID.
Our focus now shifts to the integration of the TikTok base configuration tag within Google Tag Manager (GTM). This detailed process involves several key steps, starting with acquiring your unique TikTok Pixel ID and the corresponding base script from the TikTok Ads Manager. Once these elements are in hand, they are incorporated into GTM as a custom HTML tag. To streamline future modifications and ensure ease of management, we also establish a dedicated variable specifically for the TikTok Pixel ID.
By meticulously following these steps, you'll establish a fully operational TikTok pixel within your Shopify store. This setup not only garners valuable insights into user interactions but also significantly enhances your understanding of customer behavior and engagement on your platform.
This segment is dedicated to those looking to gather comprehensive data such as item_id, item_name, value, quantity, and more during the "custom_begin_checkout" event. The provided examples of code are designed to link the dataLayer
object for Google Tag Manager (GTM) with a Shopify storefront. The primary objective is to activate a custom_begin_checkout
event whenever a user initiates the checkout process by clicking the Begin Checkout button on the Shopify Cart page.
This script sets up the dataLayer
array if it isn't already in place. It then verifies if the current page is a 'product' page and implements a specific snippet named 'datalayer-checkout' across all pages.
This portion of code is pivotal for adding product specifics to the dataLayer
object when a Begin Checkout Event is activated on the Cart page. It involves:
dataLayer
ecommerce information upon click and inputs new ecommerce data into the dataLayer
for tracking via Google Tag Manager.This code includes the head-datalayer
snippet. Depending on your Shopify theme configuration, this script is typically found within the head datalayer code. Incorporate this into the GTM Body Code.
theme.liquid
in the sidebar and click on it.<head>
section.datalayer-checkout.liquid
.<head>
tags in theme.liquid
).custom_begin_checkout
event is triggered and that the dataLayer
contains accurate product details.The usage of unique prefixes in event names (such as 'custom_begin_checkout') is to avoid any clashes with other integrations or plugins that might use standard event names.
In this section, we'll cover the steps to configure a custom Initiate Checkout tag in Google Tag Manager (GTM) for your Shopify store. This is key for capturing Initiate Checkout events and optimizing your marketing strategies.
Access Your Google Tag Manager Container: Log in to your Google Tag Manager account and select your Shopify store's container.
Create a New Tag: In the GTM dashboard, navigate to the "Tags" section and click "New" to create a tag for tracking Initiate Checkout events.
Tag Configuration: Choose a tag type that is appropriate for tracking e-commerce checkout events. If there's a specific template for Initiate Checkout events, use it. If not, you can create a custom HTML tag.
Set Up the Trigger: Develop a new trigger that activates on checkout initiation. Name it clearly (such as "CE custom_begin_checkout") to avoid confusion.
Configure the Tag: Input the necessary information, like your tracking ID or pixel ID. It’s advisable to use variables for simpler management and updates.
Select the Event: Specify "Initiate Checkout" as the event that this tag is intended to track.
Object Properties: Set up object properties to capture details about the products at the checkout stage, such as their names, IDs, categories, and other relevant data. This information can be sourced from your dataLayer or inputted directly.
Include the Currency Parameter: Ensure that the currency parameter is included in the data sent with the Initiate Checkout event, especially if your store deals in multiple currencies.
After configuring the custom Initiate Checkout tag, it's vital to test and verify its functionality for accurate event tracking.
Enable Preview Mode: Activate the preview mode in Google Tag Manager. This allows you to monitor events, tags, and triggers in a debug environment connected to your Shopify store.
Utilize Debugging Tools: Employ browser extensions or similar tools to observe the tracking of Initiate Checkout events. Ensure comprehensive data capture for each event.
Simulate Checkout Process: Navigate through your Shopify store as if you are a customer. Proceed to initiate checkout on various products and observe the debug window to confirm the proper firing of the Initiate Checkout event.
Validate Event Data: Examine the data transmitted with each Initiate Checkout event. Ensure it accurately reflects the details of the products at the checkout stage, including their names, IDs, categories, and currencies.
Submit and Publish Changes: After thorough testing and verification, submit your changes in Google Tag Manager and then publish them. This action will activate the tracking of Initiate Checkout events in your Shopify store.
By following these revised steps, you can effectively set up and validate a custom Initiate Checkout event in Google Tag Manager, enhancing your e-commerce tracking and providing valuable insights into customer checkout behavior.