Cloaking ("js/index.php") - any negative side effects?


(bit-shift) #1

Hi folks,

I want to use the provided “js/index.php” to prevent bias caused by browser-based filters. So far so good.

My only question is if there is any difference between the type of grabbed data when I use

<script type="text/javascript" src="http://www.domain.com/pwk/js/"></script>

instead of the normal tracking code?

I ask cause of the

try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}

part which obviously is missing when using “js/index.php”. :wink:

Thanks :slight_smile:

BTW: Piwik is awesome. Really really thank you - finally no visitor data for Google. :slight_smile:


(vipsoft) #2

Did you read js/README?

js/index.php (or simply js/) will act as a proxy for piwik.js and piwik.php.


(bit-shift) #3

thank you for your answer. style_emoticons/<#EMO_DIR#>/smile.gif

Let me reword my question(s): What code do I have to use to make /js/index.php

  1. act as proxy for "piwik.js"? Simply replace ``` document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); ``` with ``` document.write(unescape("%3Cscript src='" + pkBaseURL + "js/index.php' type='text/javascript'%3E%3C/script%3E")); ``` ?
  2. act as proxy for "piwik.php"? All I found was this thread: [cloaking the tracking 'tag'?](forum.piwik.org/index.php?showtopic=1745) The code mentioned there by you was ``` ``` How can this be enough? Where do I have to add the side ID?

Yes, I read README before I posted - But I still don’t see a hint about how to use it to make sure the collected data is the same as using the normal piwik.js JavaScript tracker code (how do I control whether it acts as proxy for piwik.js or piwik.php?). Sorry for my n00bism, but I am confused. For sure, if I look at the source I’ll see it is grabbing “…/piwik.js” and it acts as a basic proxy… but this did not answered my question and this is why I posted here style_emoticons/<#EMO_DIR#>/wink.gif

Edit: typos


(vipsoft) #4

Go to your Piwik dashboard, and grab the tracking code for your site.

If the siteid is 1, you’ll see two lines that read:

document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
...
var tracker = Piwik.getTracker(pkBaseURL+"piwik.php", 1);

Change it to:

document.write(unescape("%3Cscript src='" + pkBaseURL + "js/' type='text/javascript'%3E%3C/script%3E"));
...
var tracker = Piwik.getTracker(pkBaseURL+"js/", 1);

(bit-shift) #5

Thank you! style_emoticons/<#EMO_DIR#>/smile.gif