Advertisement:

Author Topic: Installing Piwik  (Read 7189 times)

Offline folding

  • Semi-Newbie
  • *
  • Posts: 16
Installing Piwik
« on: May 16, 2010, 12:03:09 AM »
I've been trying for a while now and can't figure our how to install the Piwik tracking code, the only post I could find was http://www.simplemachines.org/community/index.php?topic=254308.0 and that didn't work.

The code I am trying to add is

Code: [Select]
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://example.com/piwik/" : "http://example.com/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", 2);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://example.com/piwik/piwik.php?idsite=2" style="border:0" alt=""/></p></noscript>
<!-- End Piwik Tag -->
any help is appreciated!

When I try to add it I get this error
The file you tried to save generated the following error:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in index.template.php on line 307

Edit: I just tried escaping the ' but that didn't seem to do anything.... Let me know if I'm doing anything wrong, I'm new to SMF  :)
Code: [Select]
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://example.com/piwik/" : "http://example.com/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", 2);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://example.com/piwik/piwik.php?idsite=2" style="border:0" alt=""/></p></noscript>
<!-- End Piwik Tag -->



Okay the solution:
Code: [Select]
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://example.com/piwik/" : "http://example.com/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://example.com/piwik/piwik.php?idsite=1" style="border:0" alt=""/></p></noscript>
<!-- End Piwik Tag -->

Just edit out example.com for your site if you are also having trouble doing this :)
« Last Edit: May 16, 2010, 02:31:15 AM by folding »

Offline kokett

  • Semi-Newbie
  • *
  • Posts: 37
Re: Installing Piwik
« Reply #1 on: October 26, 2012, 06:28:08 AM »
Hello,

with Piwik 1.9 internal search tracking got available. How do I modify integration to log search?

I've read Piwik analyse search by HTTP Get, SMF uses HTTP Post. So Piwik must get search keywords by tracking variable.