Tracking Clicks on ContentAi bar within Google Analytics

Adam_Wingate
Level 2

Tracking Clicks on ContentAi bar within Google Analytics

Hello,

I am working on tracking clicks on our ContentAi bar in Google Analytics using Google Tag Manager. We are using the standard ContentAi bar, so I set up the trigger as a click on "all elements" with the filter of class = instightera-bar-content. When testing I can not make this fire correctly. We have many different pieces of content that will be served through ContentAi, so I want to use just this one tag and not a "click URL" trigger for each individual link. Has anyone experienced this problem before or have any suggestions for how to troubleshoot it?

Thank you,

Adam

2 REPLIES 2
Yanir_Calisar2
Level 3

Re: Tracking Clicks on ContentAi bar within Google Analytics

Hi Adam Wingate​,

A long time ago I published this post: http://developers.marketo.com/blog/send-rtp-recommendation-engine-clicks-to-google-analytics/

Since you're using GTM this method of sending events to GA won't work, but what you'll need to do is to create a data layer instead with the event attributes and then use it in GTM to trigger the event.

Something like:

window.dataLayer = window.dataLayer || [];

window.dataLayer.push({

'assetName': 'some name',

'assetURL': 'someurl.com/abc'

});

Adam_Wingate
Level 2

Re: Tracking Clicks on ContentAi bar within Google Analytics

Hi Yanir,

Great thank you for getting back to me. This will be helpful in building our tracking.