Hi all,
I have a website that's done in PHP. And I would like to be able to use Piwik for analytics.
To do this, I'm required to insert a little chunk of Javascript to a page.
So what I'm wanting to do is add the chunk of JavaScript to my index.php file.
I did have it working, but it caused a few problems, so I'm wondering what is the best way to go about it.
Any pointers would be great! I've been faffing with it for ages, trying to pick up tips from Google.
Here's the contents of my index.php file:
<?php
include "fennel-index.php"; ?>
and here's the chunk of JavaScript that I want to insert into the PHP:
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://ds-photo.co.uk/piwik/" : "http://ds-photo.co.uk/piwik/");
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", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script>
<noscript><p><img src="http://ds-photo.co.uk/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->
Thanks in advance!!
I have a website that's done in PHP. And I would like to be able to use Piwik for analytics.
To do this, I'm required to insert a little chunk of Javascript to a page.
So what I'm wanting to do is add the chunk of JavaScript to my index.php file.
I did have it working, but it caused a few problems, so I'm wondering what is the best way to go about it.
Any pointers would be great! I've been faffing with it for ages, trying to pick up tips from Google.
Here's the contents of my index.php file:
<?php
include "fennel-index.php"; ?>
and here's the chunk of JavaScript that I want to insert into the PHP:
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://ds-photo.co.uk/piwik/" : "http://ds-photo.co.uk/piwik/");
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", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script>
<noscript><p><img src="http://ds-photo.co.uk/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->
Thanks in advance!!
