We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Page url path problem caused by Custom Event

Page url path problem caused by Custom Event

Cameron9945
Shopify Partner
4 0 2

Recently, when I was using GA4, I found that the GA4 code added through custom event would have these fields on the page path; [/wpm@923483b2w04fb9a55pdf3e3378md2b76e35/custom/web-pixel-xxxxxx/sandbox/modern]
Please tell me how should I delete these fields, this seems to affect my use of certain functions on GA4.

 

企业微信截图_17120300416447.png企业微信截图_17120301163485.png企业微信截图_17120302823358.png

Replies 12 (12)

TGD1
Excursionist
10 0 9

Same issue here. Any ideas on how to remove these??

TGD1
Excursionist
10 0 9

@Cameron9945 I reached out to Shopify Plus support for a solution to this but they just sent me to Google Analytics support who then sent me back to Shopify support 😑

 

According to Google, there is no way to apply a filter to the URL path to remove these fields because GA4 and GTM see it all as one URL. The solution for this will need to come from Shopify. It seems they have already "addressed" the issue the sandboxed web pixel caused on URLs in Google Search Console. Hopefully they do something about GA4 soon...

Cameron9945
Shopify Partner
4 0 2

Thank you for the information. 

Twitter pixel and Bing uet tag seem to have the same problem (code running under an iframe detected via Chrome plugin).
I think these problems are caused by Shopify running Pixel code through the sandbox.

TGD1
Excursionist
10 0 9

@Cameron9945 here is what Shopify Plus support says: 

 

Jackie from Shopify Plus Developer Support here. Leena notified us that you are seeing page URLs with Shopify web pixel parameters in your reporting. The reason this is happening is because the pixels are hosted in a sandbox environment, and Google Analytics is returning the data as expected.
 
To exclude these results, you'll need to disable automatic page tracking in Google analytics and setup your own page tracking event. Check out this help doc - specifically the section on "Cleaner Page URLs". There is a link to a Google help article on how to disable automatic page tracking but it looks like it leads to a 404 currently. However, I found this article which may help: How to turn off automatic tracking in Google Analytics 4 Enhanced Measurement • WP Full Picture

Greg-J
Shopify Partner
1 0 0

And tht guy is suppose to be a "developer" ? For information, I have the same issue here, but I'm not using the client event, I'm just using the Google & Youtube native app + for each of these pages it recreates me another direct visit, my reporting are completely wrong.
In your case, if you are using GTM with client event, it is really simple, you just have to redesign the url as you want it to be and send it with your page view event in the page_location parameter.

colarosa_
Tourist
4 0 1

Here's the actual fix for this problem. 

If this was useful consider subscribing to my youtube channel.

https://www.youtube.com/watch?v=rrXRscm4tTk

thebigcagency
Shopify Partner
17 0 6

In short: What should you be looking at is the field in the sandbox that contains the "real URL" outside the URL. It is contained within the event object for every standard event you can subscribe to via

 

event.context.document.location.href

 

You should include this in every subscribe function and use it to override the page_location in GA4 hits.

analytics.subscribe("page_viewed", (event) => {
  gtag("event", "page_view", {
      page_title: event.context.document.title,
      page_locatoin: event.context.document.location.href
  })
})

 

Unfortunately a lot of other marketing tags do not have the capibility to override the source URL when sending hits (Meta Tag being one), therefore you will still be facing the same issue there.

Web: https://thebigc-agency.de | LinkedIn: https://www.linkedin.com/in/christophkleine/
Please mark as solution if my comment was able to help with your problem.
colarosa_
Tourist
4 0 1

Solved this probelm by doing most of the code work for all the platforms in a snippet file and just the customer events code for checkout. Even for other marketing tags.

See here: https://youtu.be/CnLOo7qfB74?si=Wxt_5Y2Z89TvTxDV

colarosa_
Tourist
4 0 1

Need to add - or else you'll get duplicate page views, what you're suggesting to add and the default auto page view tracking. https://developers.google.com/analytics/devguides/collection/ga4/views?client_type=gtag

gtag('config', 'TAG_ID', {
  send_page_view
: false
});



https://developers.google.com/analytics/devguides/collection/ga4/views?client_type=gtag

SamanthaAni
Excursionist
20 0 4

I am having this exact same problem, but with a custom pixel I set up in the Shopify admin for Microsoft Clarity. Do you have any advice on how to clean up the URLs so Clarity can read them...?

clarity.png

thebigcagency
Shopify Partner
17 0 6

I don't think it is possible. Much like the Meta Tag, Clarity pulls the URL from the document.location automatically and I do not see an overwrite option.
Another option would be to submit the clean URL via a custom dimension in a custom event, but I dont see that option either.
BTW Does clarity work correctly in the customer events section? 

 

Web: https://thebigc-agency.de | LinkedIn: https://www.linkedin.com/in/christophkleine/
Please mark as solution if my comment was able to help with your problem.
SamanthaAni
Excursionist
20 0 4

Thank you so much for looking...!

If you mean the "sessions," "user overview," "Browsers/Devices/Countries," "Referrer" data etc. on the dashboard, yes, customer events seem to be working correctly! 

It also does list the "top pages," but because of the inserted code in each URL, when I try to view the click heatmap data for each page, it shows incorrectly as "no clicks."