Tag: 浏览量

Google Analytics在Hash Change上设置PageView

我正在尝试在Isotope下获得一堆包含大量内容的主页 将每个哈希更改显示为Google Analytics中的综合浏览量。 最初,我打算将此作为事件,但它确实应该是网页浏览。 所以我设置了修改后的GA: (function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’); ga(‘create’, ‘UA-XXXXXXXX-X’, {‘allowAnchor’: true}); ga(‘send’, ‘pageview’, { ‘page’: location.pathname + location.search + location.hash}); 在Google Analytics中,如果有人访问特定url,我会立即看到哈希标记 – 例如: http : //www.example.com/#pet-health如果他们重新加载页面,我会在GA中看到哈希,但是如果他们点击Isotope“nav”链接进入它。 如果他们点击,我只是看到“/” 在同位素射击中,我所拥有的似乎没有起作用: //Sets up filtering on click of Isotope navigational elements $(‘#isotopeFilters a, .subnav a, #isotopeContainer .isotopeNav a, .page-template-page-home-php #logo’).click(function(){ var selector = $(this).attr(‘data-filter’); var […]

用于在第x次页面浏览后显示内容的JS cookie

我试图找到如何设置一个JavaScript cookie,以便在访问者的第4次页面浏览后显示一个fancybox弹出窗口。 这是我用来显示Fancybox弹出窗口的代码,但正如您所看到的,这只在第一次网页浏览时显示代码,并在一天后过期 function setCookie(c_name,value,exdays) { var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + ((exdays==null) ? “” : “; expires=”+exdate.toUTCString()); document.cookie=c_name + “=” + c_value + “;domain=.mysite.net;path=/”; } function getCookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(“;”); for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x==c_name) { return unescape(y); } } } jQuery(document).ready(function() { var show = getCookie("fancyreg"); if(show==null […]