views:

248

answers:

1

Hi all,

I have some javascript which calls some php functions to track webstats (piwik.org)

Everything works fine on http sites, from every browser it is all tracked

I have one site that is https - it will track visits from ie, but not from Firefox or Chrome

Does anyone know of anything I need to do or set or use to make it work on an https site?

Here is the code that goes in the html - please let me know if you need anything else:

<!-- Piwik -->
<!--"http://webstats.veritythree.com";--&gt;
<script type="text/javascript">
var pkBaseURL = "https://mysite/Webstats/";
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 6);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script>
<!-- End Piwik Tag -->

The piwik.js is pretty large but I don't know if it will help so I will refrain from posting it for now...

I tried replacing their piwik.php with a simple file of my own that just writes a text file - this works from IE, from Firefox and Chrome it doesn't even create the file

$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "V3 Developer\n";
fwrite($fh, $stringData);
$stringData = "Testing PHP\n";
fwrite($fh, $stringData);
fclose($fh);

Thanks for any help on this one!

+1  A: 

This sounds like XSS prevention. When your javascript is pointing to the secure url, are you also viewing the page through the secure url?

Mark
I think so..Here is a little more detail on the setup:There is a website that is 'http://piwik.myhome.com'When we went directly to this - ie gave the secure and unsecure items error. We created a virtual directory under the main site 'mysite.com' and called the folder webStatsSo it uses the url and certificate of the parent site, but is is separate site itself as wellDoes that make sense? I'm kind of new at this, so please forgive any bad explanations...
From what I can understand in your explanation, it shouldn't, because the javascript file is being pulled from a completely different url. See http://en.wikipedia.org/wiki/Same_origin_policyIt should work if you place the <script> tag directly in your html. You really don't need to use document.write() to write it in the page. Hope that works for you
Mark