diff options
author | diosmosis <benaka.moorthi@gmail.com> | 2013-02-26 05:57:15 +0400 |
---|---|---|
committer | diosmosis <benaka.moorthi@gmail.com> | 2013-02-26 05:57:37 +0400 |
commit | 8c0bbda883334c2136e6cb3a3b6cff34745c625e (patch) | |
tree | 79e989662506bb40d6a24fb8d287dcd80a409d01 /misc | |
parent | ace0debaa39788b3277a2e5d5407f2626364f809 (diff) |
Refs #1845, change code in proxy-hide-piwik-url/piwik.php to use async code.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/proxy-hide-piwik-url/piwik.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/misc/proxy-hide-piwik-url/piwik.php b/misc/proxy-hide-piwik-url/piwik.php index a0ddca4555..d5878bd846 100644 --- a/misc/proxy-hide-piwik-url/piwik.php +++ b/misc/proxy-hide-piwik-url/piwik.php @@ -25,15 +25,16 @@ instead of calling directly the (secret) Piwik Server URL (http://piwik-server.com/piwik/). 7) You now need to add the modified Piwik Javascript Code to the footer of your pages at http://trackedsite.com/ Go to Piwik > Settings > Websites > Show Javascript Tracking Code. - Copy the Javascript snippet. Then, edit this code and change the first lines to the following: - <script type="text/javascript"> - var pkBaseURL = (("https:" == document.location.protocol) ? "https://trackedsite.com/" : "http://trackedsite.com/"); - document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.php' type='text/javascript'%3E%3C/script%3E")); - </script><script type="text/javascript"> - try { - var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1); + Copy the Javascript snippet. Then, edit this code and change the last lines to the following: [...] - </script> + (function() { + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://trackedsite.com/"; + _paq.push(["setTrackerUrl", u+"piwik.php"]); + var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript"; + g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s); + })(); + </script> + <!-- End Piwik Code --> What's changed in this code snippet compared to the normal Piwik code? A) the (secret) Piwik URL is now replaced by your website URL |