wistia / fresh-url

Drop this script on your page and enjoy the freshest of URLs
270 stars 28 forks source link

Fresh URL tool doesn't work with GTM-Tag Events #15

Open nino-fvs opened 6 years ago

nino-fvs commented 6 years ago

Hello,

Thanks for the fresh URL tool. The script delete the UTM tag perfectly well. Unfortunately, I noticed something now. When I place for example banner ads, the visitor lands on the landing page. The UTM tag overright the original referral (UTM example: Source: welt.de, Medium: banner), registered by Analytics and hidden by Refresher. If I now trigger an event that I track via the GTM, the UTM tag will be overwritten and replaced with the original referrer (Original referral: Source: welt.de, Medium: referral). As soon as I disable the UTM refresher, everything works. Have you ever had such a thing? Thanks for your support.

Best regards Nino

bschwartz commented 6 years ago

Hi Nino, thanks for using Fresh URL! Is it possible to link me to a page where this is happening? I'm not sure I follow what you're saying. Is "Refresher" a particular script or product you're using? That's not something I'm familiar with.

nino-fvs commented 6 years ago

Hello, thanks for your answer. I made screenshot from my problem. Maybe with the screenshot it is clearer. With "Refresher" I mean your Fresh URL script. In GTM I called it Refresher ;).

First: I published a URL with a test UTM-Tag on my Devsystem. Second: I click on the link and the target URL open (https://www.flossbachvonstorch.de/de/kontakt/). In Analytics I get the Source and Medium from the UTM-Tag. With your Fresh URL script the UTM-Tag are hide. It works fine. (Screenshot 01, 02 & 03) Third: Now comes the problem. If I do an interaction for instance click on an email address (Screenshot 04) the Source and Medium (ge-display / display) in Analytics are change to the original Source and Medium (ch.fvs... / referral). The UTM-tags will be overwritten with the original referrer. (Screenshot 05 & 06). Fourth: If I delete your script everything works fine.

The page is https://www.flossbachvonstorch.de/de/kontakt/

Is it a problem with your script or with my GTM? I hope you understand what I mean. Thanks.

01 02 03 04 05 06

bschwartz commented 6 years ago

Hi @nino-fvs, I'd take a look at this page for more information: https://developers.google.com/analytics/devguides/collection/analyticsjs/pages.

All that the FreshURL script does is clean up the URL after the GA script loads. Based on their documentation, it would appear that sending subsequent events via JavaScript on the page will just reference the current document.location (which after it gets cleaned, won't have your UTM codes).

I'd recommend putting the following line in your GA script. That should "lock" the current page before FreshURL cleans it.

ga('set', 'page', document.location.pathname);

Hope that helps!