Kazz
Kazz

Reputation: 616

Adding GTM to a website with GA

I have a website that has been using GA for some time. Now someone wants me to add it to theirs GTM and replace my snippet with that GTM tag.

I don't know how to use GTM and don't really want to dig into that :/

My website was working just fine... Is there some easy way to make GTM just a simple middle man that looks at my domain and just throw everything directly to GA?

I manage to make it so GA gets info on the website traffic like active users etc. however that website has scripts that fires events to GA.

After googling a while i think this is because GTM adds some random names to the trackers and my code calls ga('send', ... ) directly :/

I know i can make a custom tag in GTM but they want it to be UA tag -_-.

Is there any way to set a default name for my trigger in GTM settings? Or some other solution?

atm. i have a code with gtm tag only and I'd rather avoid changing my web code if possible.


Edit

Ok, could someone explain to me how to achieve this:

I have this code:

var a = $('meta[property="a"]').attr('content');
var b = $('meta[property="b"]').attr('content');

ga('send','event',a,event,b);

where event is one of several possible strings of for example
'event_1','event_2' or'event_3'

and my GA has 3 goals that have action = 'event_1' etc.

How do i replace this with GTM and dataLayer?

Upvotes: 1

Views: 325

Answers (1)

Kemen Paulos Plaza
Kemen Paulos Plaza

Reputation: 1560

This thread has 2 questions :

1.- Migrate a hardcode implementation of Google Universal into Tag Manager is not so simple as copy and replace the Universal Main Snipper for the GTM Code. Look for this google guide to migrate. Has more or less the steps needed and the one to take in consideration during the migration.

https://developers.google.com/tag-manager/devguide#migration

If you goes for GTM, it's higly recomended to remove your ga() function on the page, this will stop working and you javascript too. Basically this mean, remove all your Google Analytics of the domains and install GTM and configure the corrects tags. Try to avoid things like paste the Google Analytics code inside a custom HTML tag, it's a very bad practice, but is see that a lot. Plan your migration

2.- Regarding the event you have to do :

Create a tag of universal analytics events and activate when you pushes a GTM event, them manage this values via the dataLayer Let this link for more information: https://support.google.com/analytics/answer/6164470?hl=en

var a = $('meta[property="a"]').attr('content');
var b = $('meta[property="b"]').attr('content');
dataLayer.push({'event': 'ga_event' , 'cat' : a , 'act' : b})

Try to involve more yourself in the GTM and Universal's World before ask, i'm not trying to be an asshole, but this question involves so many things that can be solved just looking the documentation, and somany thing to examplain in a single post.

Upvotes: 1

Related Questions