How to track newspaper/TV ad with Piwik

Had a request from a client to help them shorten down the url for the ad they were going to put in a printed brochure plus a newspaper.

The url is ‘ -&nbspThis website is for sale! -&nbspmywebsite Resources and Information.’ but they wanted the regular home page to load and in the process record in Piwik the fact that their entry page was

I created the folder 2012 in the root, and within it the single file titled index.html containing the following code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta name="robots" content="noindex", "nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="3;url=">


<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "" : "");
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);
} catch( err ) {}
</script><noscript><p><img src="" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->

You should be automatically redirected to the <a href=""></a> homepage within 3 seconds.


  • Note that the part where it says you can change the number ‘3’ to however many seconds you want. You could also add a small logo/image to the page just for people to look at.

The 2 X winking smiley’s seems to be replacing the ; and ) in the code.

I also have a goal set up to check for the title of the redirecting index.html page (you can give it what ever title you wish)

Many thanks to Matt for his help in getting the solution sorted out.