Record id and clicks a user makes

117 Views Asked by At

In this page, avang.ir/ssd-landing, I want to see if it is possible to records every click a user makes in a date and time of any button with any class or Id. The page I mentioned above contains a wizard which I am trying to record user click flows. No service such as Hotjar gives such data that I need to analyze how users enter, explore and exit.

1

There are 1 best solutions below

5
On

You have several different ways to do this.

Checking the URL, the GTM container, and the Google Analytics tag is already installed.

Have you tried to create a tag that fires every time users click in any element of or site? you can create a general Google Analytics universal Tag, using the "event" track type and add a trigger that will fire using configuration rules.

enter image description here

enter image description here

Now if you want to pass the date and time(like a timestamp) in every event hit by any user, you can create a custom dimension with scope hit in google analytics property configuration, in this example the index of this dimension is 10.

enter image description here

After the custom dimension creation. You need to pass the "date and time" for every hit to Google Analytics. You can do this creating a javascript variable into Google Tag Manager.

function timestamp() {
    // Get local time as ISO string with offset at the end
    var now = new Date();
    var tzo = -now.getTimezoneOffset();
    var dif = tzo >= 0 ? '+' : '-';
    var pad = function(num) {
        var norm = Math.abs(Math.floor(num));
        return (norm < 10 ? '0' : '') + norm;
    };
    return now.getFullYear() 
        + '-' + pad(now.getMonth()+1)
        + '-' + pad(now.getDate())
        + 'T' + pad(now.getHours())
        + ':' + pad(now.getMinutes()) 
        + ':' + pad(now.getSeconds())
        + '.' + pad(now.getMilliseconds())
        + dif + pad(tzo / 60) 
        + ':' + pad(tzo % 60);
};

Now you can pass this value from every hit in your Google Analytics Tag. Note that in the figure below I used the dimension index for what was created in google analytic. Configure your category, action, and label according to the information you want to transmit

enter image description here