event tracking - custom variable issue in google analytics -


Using the following code to track users' clicks by using Hi Custom Configurator. But my custom variable has been reported that counting is increasing for user logging, but not for button click event. In a variable, the User ID is logged in as a login in the login and custom variable method.

jQuery .ready (function () {

jQuery ('# buybutton') .on ('click', function () {

  _gaq.push (['_setCustomVar', 2, 'gaid', & lt ;? php echo (json_encode ($ userName)) ;; & gt; 1]); _gaq.push (['_ trackEvent' , 'Button-webtrader', 'click', 'webtrader-buttonclickevent']);});});  

I have found a solution for this. Instead of custom variables, I used Event Tracking to achieve this. I have used the following function in the click event of the button.

  _gaq.push (['_ trackEvent', 'button-category', 'click', 'user clicked: & lt;? Php echo (json_encode ($ userName)) ;; & gt; ']);  

The above "$ userName" includes the logged in user ID from my site. Now, I can see a particular user's click -> events-> page-> your page-> event category-> event-action-> event label using your ID under your behavior. Since the username is personally identifiable according to Google, I have not used the username.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -