Cookiesdirective and Statcounter
Cookiesdirective and Statcounter
我已经实现了cookiesdirective.js,它可以在cookiesddirective.com中找到,并且Statcounter代码不起作用。我正在使用以下代码(DoYourOwnSite,标准):
var sc_project=9181072;
var sc_invisible=1;
var sc_security="328a83d2";
var scJsHost = (("https:" == document.location.protocol) ? "https://secure." : "http://www.");
document.write("<sc"+"ript type='text/javascript' src='" + scJsHost + "statcounter.com/counter/counter.js'></"+"script>");
由于cookiesdirective.js需要删除标签,我已经删除了它们,但它仍然不起作用。另一方面,Google Analytics的代码运行起来没有问题。我确信这是关于更改代码,使其在另一个javascript中工作,但我现在不知道如何做到这一点。
谢谢,Goran
已解决。我不得不稍微更改一下statcounter代码:
var sc_project=xxxxxxxxxx;
var sc_invisible=1;
var sc_security="xxxxxxxxxxx";
var imported = document.createElement('script');
imported.type = 'text/javascript';
imported.async = true;
var scJsHost = (("https:" == document.location.protocol) ? "https://secure." : "http://www.");
imported.src = scJsHost + "statcounter.com/counter/counter_xhtml.js";
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(imported, s);
无论如何,谢谢。
相关文章:
- Selenium WebDriver and JavaScript change
- PHP and Javascript functions
- Javascript Return and if/else
- SetTimeout and clearTimeout in Javascript
- lightbox in html 5 and javascript
- TimelineJS and AngularJS
- timeago.js with datatable and PHP
- javascript button ajax and php
- Ajax and Json with Rails
- Combine onload, onresize and onclick
- php布尔值's小写AND大写和数字布尔值'可以接受
- setTimeout and V8
- Jquery post and onclick
- Moment js and IOS
- Rails 3.2 and Paloma gem
- Backbone, TypeScript, and super
- iframe and JavaScript on different pages
- JSON and jQuery Search
- Flash and External Javascript
- Cookiesdirective and Statcounter