Tracking any events – Google Analytics

Last updated: August 12, 2022 Written by: Avatar Teresa
Table of contents
Table of contents

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 editor of the landing page.

2. Select the item for which you want to track events – in our example, it is an image widget. Next, unfold the Other tab and copy the ID of the selected item in the side menu on the right.

3. Go to Dashboard -> JavaScript Codes -> Add script and paste modified code according to the following scheme as new JavaScript code.

$('#IDcopiedfromtheeditor').on('click', function () {
// begin of copied script:
gtag('event', 'click', {
'event_category' : 'images',
'event_label' : 't-rex'});
// end of copied 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 manual helpful?