single php
cdp menu

Setup Shopify Event Tracking in Google Analytics and Facebook Pixel

·

·

Shopify Event Tracking in Google Analytics & Facebook Pixel Direct Integration

iOS14+ updates, GDPR, CCPA, & other data privacy regulations have brought in awareness among the organizations and individuals about the limitations of third-party data tracking and its negative impact on the ad campaign performance in the present times.

The recommended solution to tackle these issues is to equip the ad platforms with relevant first-party data that can be shared via server-side integration from your Shopify store.

Shopify Event Tracking

Track all the events in your shopify store seamlessly using our direct integration without writing a single line of code. Once the events are tracked, you can easily integrate your first-party data with Google Analytics (GA4) & Meta (formerly Facebook).

Haven’t migrated from Google Universal Analytics to GA4 yet? – Step by Step process to migrate to GA4 seamlessly

Let’s go with a step-by-step process to set up the direct integration in less than a few minutes.

Step 1: Account Set up

As soon as you sign up, your account is readily set up and you progress to the second stage where your domain is automatically generated in the connect your domain section. You can change it if you want to integrate another shopify store.

Screenshot of CustomerLabs Dashboard with first-step - Connect website

Click on ‘Save’ after you enter the url.

Step 2: Connecting your Shopify store

After you click on Save, you will get a tracking code. Copy the code using the copy button on the right side of the code to track all the events on your Shopify store.

Screenshot of CustomerLabs Dashboard with event tracking code. This pixel code if put on your Shopify Store, all the events that Shopify pixel will collect will also be collected for event tracking of all your events on Shopify store.

This code should be pasted in your Shopify store.

And to do that, login to your shopify store and click on Online store and then Themes. Click on Actions and then Edit code.

Shopify screenshot showing how to edit the code and insert scripts of your choice anywhere in the code

You get the below screen. Click on theme.liquid and search ‘</head>’.

Paste the code you copied from CustomerLabs dashboard just above </head>

Save it.

CustomerLabs Pixel Code to be pasted in Shopify Pixel code place for Shopify Event Tracking

Now navigate to customer events to create a custom pixel for your Shopify store to track all the events.

Screenshot from Shopify store showing step by step process to add custom pixel code. When you do this the Shopify datalayer events will be synced with CustomerLabs with the help of CustomerLabs pixel code imbibed within the Shopify pixel code datalayers.

Add custom pixel > Give the pixel name as CustomerLabs > Add pixel

Doing so will send Shopify events tracked including Shopify GA4 purchase event & Shopify Facebook Pixel event to CustomerLabs if you follow the below steps.

Step 3: Direct Integration of Shopify store for event tracking

Next step is to go back to Your Account Dashboard on CustomerLabs.

Scroll down on the home section to find the Shopify logo under the default eCommerce events section.

Here there will be two primary differences.

Your shopify store might have a post-purchase page or might not have a post-purchase page. Now, to track events on your Shopify store that has a post-purchase page, follow these steps. If you do not have a post-purchase page, you click on the without post-purchase button and follow upto step 6 with the variation only in step 1.

Shopify event tracking on stores with a post-purchase page (Common for Shopify store without a Post purchase page until Step 6)

Step 1:

Click on Shopify logo and click on Shopify with Post-purchase

CustomerLabs dashboard screenshot showing Shopify with Post-purchase button

Step 2:

In the displayed box, you will find steps. In the 3rd step, you will find the custom pixel code for your shopify store.

Screenshot of the Custom Pixel code for Shopify

Step 3:

Copy that code and paste it in your shopify store’s customer events pixel code. And to do that go to Customer events > CustomerLabs Pixel (The one you created)

Code pasted on Shopify Custom Pixel place

Step 4:

Click Save > Click Connect

Shopify Store Custom Pixel code connect button

Step 5:

Go to CustomerLabs dashboard where you found the above pixel code. Copy the 4th code in the dashboard.

Shopify Code in CustomerLabs Dashboard

Step 6:

Paste this code into the checkout page > Additional scripts > Order status page > Click Save

Order Status Page Screenshot on Shopify Store

Step 7:

Go to CustomerLabs dashboard home page where you have clicked on Shopify logo and again from that, copy the 5th code 

Step 8:

Back in your Shopify, navigate to Checkout section in the settings > Additional scripts > Post-Purchase page

Paste the copied code here and click on Save.

Post Purchase script page on Shopify with CustomerLabs Script

That’s it. Your Shopify store and Customerlabs are now in sync to leverage the potential of first-party data.

To verify if your Shopify store integration is successful, perform some actions such as added to cart, checkout made, etc., and then click on verify event data on the CustomerLabs dashboard page to see the data populating there.

By default all the events that will be tracked for your Shopify store are:

Product viewed event

Category viewed event

Added to cart event

Search made event

Checkout made event

Add Payment info event

and Shopify Purchase event

All the above events can be sent to GA4 and Facebook

Now all Shopify datalayer events and Shopify pixel events that are shown above are synced with CustomerLabs and are ready to be sent over to GA4 and Facebook.

However, if you want to track other custom events, you can use the No-Code event tracker and track all the custom events as you want.

For example, you can track the ‘add to wishlist’ event on your shopify store 

Shopify ‘Added to Wishlist’ event tracking using No-Code Event Tracking

From the dashboard, click on the ‘Launch No Code Event Tracker’ button. This will redirect you to your connected Shopify store. 

Screenshot of CustomerLabs CDP dashboard showing WooCommerce, BigCommerce, Shopify Integrations and Launch No Code Event Tracker Button

On your Shopify store you will see the event tracker dialogue box with the name Record Actions:

To track add to Wishlist events, ensure the below are done

Action Name: Added to wishlist > Action type: On-Click > Click on the Element Picker > Pick the Add to Wishlist button

Shopify Store with No Code Event Tracker of CustomerLabs, the real-time CDP

Click on ‘Add Details’.

Attributes:

In the next step, Use the attribute type as text. Select all the important attributes such as product name, product price, product id, product quantity etc.

Select the attribute, then pick that block using the element picker. Click on Save.

Once you are done with adding all the attributes you need to understand the data, click on Next | Post-trigger action button.

Shopify Store with CustomerLabs event tracker that is collecting attributes

Clicking so will land you in the next stage of tracking events on your shopify store which looks like below.

Shopify Store with CustomerLabs No Code Event tracker that displayed if you want to track the events on single page or all pages

If you want to track this event across all the pages, choose all pages and save.

Finally, click on Update Action.

Save the events tracked.

This will track the user behavior of all the users who clicked on the Add to Wishlist button.

Verify if the event tracking data is being collected or not by using the ‘verify event data’ button on the dashboard.

Click on view data > recent data

You can see all the events being tracked over there.

Shopify Google Analytics Integration using CustomerLabs Direct Integration

Just a few clicks and your Shopify store is in sync with Google Analytics. And you will receive Shopify event tracking data on Google Analytics.

In the home page, find the ‘destinations’ icon in the left side menu.

You will find all the destinations available. 

Click ‘Google Analytics gtag’

The below screen will be displayed.

CustomerLabs CDP Dashboard showing Integration with Google Analytics

Now you should click on Enable.

After you enable the Google Analytics Integration for your shopify store, you will have to configure.

CustomerLabs CDP Google Analytics Gtag

Once entered into the Configuration settings, you will have to enter the GA4 measurement ID. 

Still on Universal Analytics? Do not be left behind. GUA is going away. Here’s the blog that shows you how to migrate to GA4 on Google Analytics from Google Universal Analytics.

Authentication:

Now, once in GA4, you will get the measurement ID by following the below steps.

Admin Panel > Setting > Data Streams > Website > Measurement ID

Once you have the GA4 measurement ID, enter it in the configuration settings on CustomerLabs Google Analytics integration.

CustomerLabs & Google Analytics Integration Dashboard

After you enter the GA4 ID in the website tracking ID field, click on the Sign in with Google button in the Advanced Settings section.

Once the authentication is successful, below screen will appear in front of you.

CustomerLabs CDP integration Dashboard process step 4

Choose the Account where you want to sync the event data collected on your shopify store with Google Analytics. 

Similarly, choose GA4 on choose web properties. 

You will see a message – Authentication Successful.

Click on Submit.

Your screen should look like below after you enable the GA4 Measurement Protocol to ensure that you are connected to Google Analytics successfully to integrate all tracked events of your shopify store.

CustomerLabs Dashboard for GA4 integration set up process

Enter the API Secret key.

Toggle on ‘Enable User-ID tracking for anonymous users’. 

To leverage the full potential of CustomerLabs CDP to track events of your shopify store and integrate it with Google Analytics, you have to enable the enhanced eCommerce option by scrolling down on the screen. 

Once you have done all these steps, click ‘Save changes’.

And done. You are now ready to sync all the event data that you tracked on your shopify store using our No Code event tracker and the few-clicks integration of Shopify store with CustomerLabs CDP on Google Analytics.

Refer to the full documentation for more details on Google Analytics Integration.

Shopify Facebook Integration using CustomerLabs Direct Integration

You might have already noticed the Facebook Conversions API Integration in the same destinations dashboard earlier where you found the Google Analytics Gtag integration.

Click on it and click on Enable

CustomerLabs and Facebook Integration

Once you click on Enable, the below screen will appear.

CustomerLabs Integration of Facebook dashboard screenshot step by step process step 1

For your Shopify store to synchronize all the events you tracked using CustomerLabs CDP you have to finish configurations on your CustomerLabs Dashboard.

Click on Configuration settings

Click on the Authenticate Facebook account button. 

Doing so will redirect you to Facebook.

Select the account you have admin access to and the one authorized to run ads.

After you select the account, it will prompt you to choose the page for which you want to run the ads.

Once you choose and move forward, it will automatically redirect you to the CustomerLabs dashboard and the below screen will appear.

CustomerLabs Facebook Integration

Next choose your Facebook Pixel from the above screen and submit.

CustomerLabs Integration with Facebook Dashboard

On the above screen, toggle the send data via server-side ON.

Finally, click on Save Changes.

Now, you have chosen to send the data via server-side for your Shopify store.

Note: If you do not have a pixel created already, follow the below steps to create one.

Meta Business Manager > select your business > Data Sources > Pixels > Add (you will find this near search bar) > Enter Pixel name of your choice > insert website URL > Continue 

Your Shopify Store is now fully integrated with Facebook and ready to send event data collected through CustomerLabs CDP. 

Refer to the complete documentation for more information on Facebook Integration here.

Collect your First Party Data with No Code Event Tracker by CustomerLabs for Direct Integration with Shopify

Frequently Asked Questions (FAQs)

If you are doing it manually using any other complex method, yes, you have to write. However, if you are going with a No-Code CDP like CustomerLabs, without writing a single piece of code, you can setup your Shopify Store's event tracking using our direct integration for most of the events. In addition to that, if you want any custom events to be tracked, you can seamlessly, track those events using our No-Code Event Tracker.
GDPR, CCPA and other laws across the globe prevent you from using any third-party. It is highly recommended to go with a CDP like CustomerLabs, which is your perfect Wingman and stores all your data with complete privacy in compliance with data privacy laws around the world.
Yes, when you are going with a No-Code event tracker, it is a gameplay that you can simply perform the same actions that you want to track with the event tracker on.

Marketing enthusiast who enjoys writing articles on a wide range of topics including Marketing, SaaS, Technology, Construction, Life lessons, Public Policy Nature, and Sustainability. Good at Public Policy analysis with a deeper understanding of societal issues and potential solutions. Also loves to volunteer & contribute to society in every possible way.

The latest news, perspectives, and insights from CustomerLabs

More Blogs

View all
Value Based Bidding in Google Ads blog banner that shows Google Ads Logo and how Value based bidding will contribute in your ad campaign success boosting your business goals - higher target ROAS, Maximum Conversion Value bidding strategy
Value Based Bidding in Google Ads | Comprehensive Guide

Learn how value based bidding can maximize conversion value and profit margins. Know how it works & the best practices to implement it on Google Ads.

Read more
The blog banner shows an infographic where GCLID WBRAID & GBRAID parameters are synced with Google Ads
What are GCLID, GBRAID and WBRAID parameters?

GCLID parameter lets Google ads track the conversion from non iOS devices. WBRAID and GBRAID parameters help track metrics from iOS device

Read more
Smart Advanced Audience Segmentation for eCommerce Businesses blog banner by CustomerLabs providing tips & segmentation hacks.
Smart Audience Segmentation for eCommerce Businesses in 2023

Improve your ad campaign performance and purchasers by smart segmenting your audience using first-party data for your e-commerce stores

Read more

Get started with CustomerLabs CDP

Schedule a 1-1 Demo

Ecommerce

Unified data to boost ecommerce growth

B2B

Engage your customers across the funnel with a unified martech stack

SaaS
Saas

Increase product metrics with a unified martech stack

Agency
Agency

Scale your customers quickly with the right data