Javascript Overlay / Interactive Tracking with Google Analytics

Using javascript (jQuery, to be precise in my case) I need to enable the tracking dialog in Google Analytics as a unique view of the page, although it is only a modal overlay.

For contextual purposes, I do not want the user to leave the page, and the contents of the dialog are loaded through an ajax call.

+3
source share
2 answers

Assuming you are using the new Google Analytics asynchronous code, all you have to do is place this code in a JavaScript block where you render your modal dialog.

 _gaq.push(['_trackPageview', '/fake/modal/path/here']);

,

   pageTracker._trackPageview('/fake/modal/path/here');

, _trackPageview , , . , , . URL, :

+11

Google, ga.js . , , analytics.js, :

ga('send', 'pageview', '/fake/modal/path/here');
0

Source: https://habr.com/ru/post/1762738/


All Articles