Google Analytics event tracking on buttons & hyperlinks

Dennis Hulsmans asked on January 23, 2017 09:20

Hi

Got a question of our online marketeer: What's the best way to achieve Google Analytics event tracking on form buttons, hyperlinks, ... . Or can this be done within Kentico?

I'm not that familiar with the whole online marketing stuff yet, so I hope someone can help me :)

thanks!

KR, D.

Recent Answers


Michal Samuhel answered on January 23, 2017 10:09

Hi Dennis,

This is more of a general integration question. There could be some guys in here, that could have already implemented this, but based on the following documentation, you can just create another call with GA send command:

https://developers.google.com/analytics/devguides/collection/analyticsjs/eventshttps://developers.google.com/analytics/devguides/collection/analyticsjs/sending-hits#on_the_tracker_object_itself

These JS actions can be envoked in Kentico like in any other .NET app.

1 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on January 23, 2017 13:01

You can achieve this very easily using a Javascript.

If you look at GA Events https://developers.google.com/analytics/devguides/collection/analyticsjs/events

ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);

You need to send three parameters eventCategory], [eventAction], [eventLabel]

On any HTML element which you want to record write a generic method that can populate these parameters and send this to the above method available in GA.js file

I hope this helps

2 votesVote for this answer Mark as a Correct answer

Dennis Hulsmans answered on January 24, 2017 13:36

Hi

Thanks for the replies, I'm aware of the GA events, and I can add them manually on hyperlinks. But a developer has to do this, an online marketeer can't do this (they usually don't have the correct know-how I guess).

How do you add this on the submit button of a Kentico form? You can't change the HTML of that button, unless you use the ASCX layout or custom javascript.

To change this, you'll always need a developer I think.

KR, D.

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on January 30, 2017 12:40

If you want to provide flexibility to the Marketing guy this route is not ideal for you. What you should opt for is Google Analytic Tag manager

This is how I work with my marketing clients. You still have to work with them initially however it's a way easy way to setup GA without your continuous involvement

2 votesVote for this answer Mark as a Correct answer

Dennis Hulsmans answered on January 30, 2017 15:43

Hi Chetan

Google Tag Manager is according to me a must, but do you use a custom javascript that searches for all hyperlinks which adds the event tracking on the hyperlinks?

KR,D.

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on March 1, 2017 17:44

Yes I created a small JavaScript too to handle any anchor tag on the page. The framework provided support to access certain attributes like action_tag, label_tag, category_tag to be also send to GA. these tags were say in transformations this making everything dynamic

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.