-
Making the Switch to GA4: Handling Legacy Code
“Hiya folks, newbie here. I’ve been roped into moving my company’s analytics over to GA4, but the thing is, I’ve never messed around with this stuff before. I’ve set up a new property on the google analytics page and popped this code just under the head on the website.
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());gtag('config', 'G-XXXXXXXXX');
</script>
Now I’m kinda stuck.
1. Should I get rid of the old UA tracking code on the website? Will the sky fall if I leave it with the GA4 code?
2. Do I need to do anything specific with the old events, or will GA4 use some magic to move them over on its own? You know, thega('send', {xxxx})
ones?Any help you can give me would be absolutely brilliant. Cheers!
P.S. I’ve connected the original UA to GA4, and both bits of analytics code are hanging out on the website. I can see it tracking data as users click around. I’m just worried it might kick the bucket come July 1st when UA wraps up.”
Log in to reply.