Tracking any events – Google Analytics

11.02.2019

If your landing page has already a global website tag (gtag) implemented as instructed, you can also track other events in the GA on any landing page elements, such as text or images – all you need to do is to copy the ID of this element to use it in javascript code for event tracking.

How to track an event on the chosen landing page element in GA?

1. Log into your Landingi account and go to the edition of the chosen landing page. Select the item for which you want to track events (1) – in our example, it is an image widget. Next, find and copy the ID of the selected item (2) in the side menu on the right.

image_copy-id

2. Go to Dashboard -> Javascript codes -> Add script and paste modified code according to the following scheme as new JavaScript code.

<script>
$ ('#IDcopiedfromtheeditor') .on ('click', function () {
// begin of copied script:
gtag('event', 'click', {  'event_category' : 'images',  'event_label' : 't-rex'});
// end of copied script
});
</script>

In place of ‘IDcopiedfromtheeditor’, paste the ID copied from the editor and replace our sample snippet of code with your own one – in our case it is:

gtag ('event', 'click', {'event_category': 'images', 'event_label': 't-rex'});

Save the code in the body bottom position.

To check GA reports with events, log into your Google Analytics account and go to Behavior -> Events -> Overview.

Remember that events can be visible in Google Analytics reports with up to 24 hours delay.

Was this article helpful?

Can’t find what you need?

Let us help you!
Send us a message
We are using cookies for analytical purpose. Learn more.