by ShahzadaAliHassan - 14th December 2023
In this Blog , we'll explore how to effectively integrate TikTok Pixel Purchase 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.
To effectively monitor user interactions on your Shopify store, it's essential to integrate the Google Tag Manager (GTM) Container.
Begin by embedding the necessary Google Tag Manager scripts into your Shopify store. These scripts are pivotal for capturing user activities and gathering insightful data.
Proceed by embedding the GTM container's head and body scripts into the theme files of your Shopify store.
<head>
tag.<body>
tag.Post-implementation, it's crucial to confirm the functionality of Google Tag Manager in your Shopify store.
Use Google Tag Manager’s preview mode to verify correct setup, ensuring the container is operational on your Shopify store. This step is critical for the effective functioning of Google Tag Manager, paving the way for subsequent Analytics and Ads tracking enhancements.
Reminder Substitute 'GTM-XXXX' with your specific Google Tag Manager container ID.
Our next objective involves integrating the TikTok base configuration tag into Google Tag Manager (GTM). This procedure starts with acquiring the unique TikTok Pixel ID and the foundational script directly from your TikTok Ads Manager. Once these components are in your possession, they are to be incorporated into GTM as a bespoke HTML tag. To streamline future modifications, we will also establish a dedicated variable for the TikTok Pixel ID.
By adhering to these comprehensive steps, you will successfully establish a fully operational TikTok pixel in your Shopify store. This setup is key to gaining deeper insights into customer interactions and behaviors, enhancing your digital marketing strategies.
The provided instructions outline how to incorporate the dataLayer
object of Google Tag Manager (GTM) with a Shopify storefront. This setup is designed to trigger a custom_purchase
event when a customer lands on the Shopify /thank-you/ page following a payment.
first_time_accessed
) and, for existing customers, retrieves their order history and spending totals.dataLayer
object, if it isn't present, and fills it with purchase specifics such as transaction ID, total amount, shipping, tax, currency, and item details within the order.Accessing Your Shopify Admin Area:
/admin
.Navigating to Checkout Options:
Settings
on the menu to the left.Checkout
from the dropdown menu.Finding the Additional Scripts Option:
Order processing
section, locate the Additional Scripts
text box, designed for scripts that execute on the order status page post-purchase.Inserting the Script:
Additional Scripts
field.Saving Your Work:
Save
.Script Testing (Crucial):
dataLayer
.Reminder: The
Additional Scripts
section under Checkout settings is intended for scripts that activate following a purchase completion. This includes conversion tracking, analytics, and other sale-confirmation scripts.
In this section, we focus on setting up a custom purchase tag in Google Tag Manager (GTM) for TikTok pixel integration. To accomplish this, we'll leverage a template provided by the TikTok pixel team. Follow these steps:
Access Google Tag Manager: Log into your GTM account and open the container linked to your Shopify store.
Use the TikTok Pixel Template: Choose the TikTok Pixel tag template, available in GTM's template gallery. This template is specifically designed for TikTok pixel integration.
Configure the Tag Settings: In the tag configuration, set the 'Pixel ID' to the variable storing your TikTok Pixel ID. For the event type, select 'Complete Purchase'.
Set Up Data Layer Variables: Ensure you extract necessary user data, such as email and phone, using Data Layer Variables. This information is crucial for accurate tracking and attribution.
Define Event Parameters: Use the G4 data layer system for defining event parameters like 'currency', ensuring they align with your e-commerce setup.
Assign a Trigger for the Tag: Create a custom event trigger that activates for the specific purchase event. Use the event name that matches your data layer script.
Finalize and Save Your Tag: After setting up the configurations, save your tag. Ensure it's aptly named for easy identification, like 'TikTok Purchase Event'.
After configuring the tag, it's essential to test and verify its functionality.
Activate Preview Mode in GTM: In your GTM dashboard, enable the preview mode. This action will connect the GTM container with your Shopify store for testing purposes.
Conduct a Test Purchase: Visit your Shopify store, add a product to the cart, and proceed to checkout. Use a test mode or a 100% discount code to simulate a purchase transaction.
Inspect the Purchase Event on the Thank You Page: After completing the purchase, check the GTM debug window for the custom purchase event. Ensure it's triggered as expected.
Utilize TikTok Pixel Helper for Verification: With the TikTok Pixel Helper tool, confirm that the 'Complete Purchase' event is firing correctly on the thank you page.
Check Data Layer for Accurate Event Data: Ensure that all the transaction details, including the transaction ID, value, and product information, are correctly transmitted. Also, verify that user data such as email and phone number are captured if provided.
Finalize and Publish the GTM Container: Once you have confirmed that the purchase event is tracking correctly and the data is accurate, go ahead and publish the changes in your GTM container. This step will activate the tracking on your live Shopify store.
In summary, setting up and verifying a custom purchase tag for TikTok in Google Tag Manager involves a series of methodical steps to ensure accurate data tracking and integration with your Shopify store. By accessing GTM, creating a new tag using the TikTok Pixel template, configuring tag settings, defining event parameters, and assigning the correct trigger, you establish a robust foundation for tracking TikTok purchase events. Testing and verification are crucial, involving GTM's preview mode, conducting test purchases, using the TikTok Pixel Helper, and thoroughly checking the data layer for correct event data.
The process culminates in the finalization and publication of the GTM container, ensuring that the tracking is live and functional on your store. This setup not only enhances your understanding of customer behavior on your Shopify site but also empowers you to optimize your TikTok advertising campaigns based on precise and reliable data. With this in place, you're well-equipped to leverage the full potential of TikTok's advertising capabilities, aligning your online store's marketing strategies with data-driven insights.