Javascript Overlay/Dialog Tracking with Google Analytics

旧城冷巷雨未停 提交于 2019-12-03 08:47:26
Yahel

Assuming you're using Google Analytics new async code, all you need to do is place this code in the JavaScript block where you render your modal dialog.

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

If you're using the old code,

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

The basic gist of this is you should attach the _trackPageview call anywhere you're binding an event event that changes the modal. If you're doing this for multiple modal pageviews, you'll need to either manually code each internal modal page, or programmatically name them. If these modal changes trigger changes in the URL's hash, you could try this approach: Tracking Anchor Links in Goal Funnels

As per Google's documentation, ga.js is now a legacy library. So if you are using the latest version of this library, which is analytics.js, then the response would be:

ga('send', 'pageview', '/fake/modal/path/here');
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!