Headless Shopify & GA4 tracking

Headless Shopify & GA4 tracking

Charlieim
Shopify Partner
9 0 1

Hi, 

 

We're currently working towards a Sanity (Next.js) & Shopify headless setup for a site. In theory, it'll all be served from the Sanity side and then when it comes to checkout, the user will be handed over to the Shopify side. The Shopify side will be hosted on a subdomain.

 

Just hoping for some advice about the best ways to track data / connect to GA4, please?

Replies 7 (7)

Small_Task_Help
Shopify Partner
830 28 75

Hi,

 

Install and setup GA4 tracking in both Next.js and Shopify
Check cross-domain tracking set up

To Get Shopify Experts Help, E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Expert Agency
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad
Charlieim
Shopify Partner
9 0 1

I had thought the same initially, however, after some research, it looks like there is the option of:

 

  • Using GTM on the Next.js side 
  • Using Google & YouTube app on the Shopify Side

 

Have the same Gtag/data stream for both platforms as GA4, by default, will track over subdomains and domains if the Gtag is detected on both. It's suggested that this doesn't require any set up of cross-domain tracking.

Does that sound right to you? Would you recommend another way instead?

Small_Task_Help
Shopify Partner
830 28 75

You can use GTM for both

To Get Shopify Experts Help, E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Expert Agency
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad
Charlieim
Shopify Partner
9 0 1

That's great thanks for the help.

 

Would the Google & YT app be more accurate for data do you think? 

Sam_Mahmud
Shopify Partner
295 9 15

Hello charlieim,

Google ads and YT app is accurate but not as accurate as Google Tag Manager. 

Google Tag Manager has the feature of server-side tracking with first-party domain setup.

server-side tracking with a subdomain or first-party domain bypasses all kinds of cookie blockers, IOS 14 updates or browser restrictions.

 

 

Your COFFEE TIP! Can Create something incredible!
Require Assistance with website design or enhanced conversion tracking Via Google Tag Manager GTM ?
sam.analyst4@gmail.com! or WhatsApp!
Solved? accept it as solution with like
Consentmo-GDPR
Shopify Partner
43 4 8

Hey  @Charlieim,

You can definitely manage everything with one GTM property on both sides.

If you are interested in a compliance app, check out Consentmo GDPR . Our solution supports headless stores and integrates smoothly into the checkout.

We are also TCF Compliant and Google CMP Certified, an recently introduced a new super cool native mobile view which can be tested for free.

If you need any help regarding compliance or have any additional questions our team would be more than happy to help 🙂 

Cheers,
The Consentmo Team


Consentmo - The only Shopify app that has everything the Law says

Pandectes
Shopify Partner
78 1 23

Hello, I agree with @Small_Task_Help you can do your job with one GTM property on both sides. If the store has to be GDPR compliant, we provide a solution called Pandectes GDPR Compliance, which covers headless stores and is available inside the checkout journey.

Please let me know if it works by giving it a like or marking it as a solution!
Pandectes GDPR Compliance - #1 GDPR app for Shopify merchants.
Pandectes - 100% Free Cookie Scanner.
Free plan available. Live Chat Support is available 24/7.