Tutorial: Use any image file for Piwik tracking (Track email open rates, forum signatures, and more!)

I wrote a tutorial on custom image tracking using the Tracking API:
http://khromov.wordpress.com/2011/11/10/collect-visitor-stats-using-any-image-with-the-piwik-tracking-api/

It is useful for tracking email open rates, forum signatures - basically any place where you can show an image.

Feel free to give feedback either here on in the blog comments.

Thanks for posting this here!

Also, maybe mention that only some clients will show images by default, most will ask for confirmation. so, many image beacons will not be loaded, especially if the newsletter does not use images a lot and people don’t click on “Allow images”.

I have made a slight update to the post!

If your tracking image is used on a page, you will see what page it is used on. (Via HTTP referrer.)

If I have a Buy Button Image on my page how can I track how many times it was clicked on?

Thank you for this post, it help me a log!

Thank you littleman, I got the code working.

Except that the IP I am getting is my server’s own IP, not the users (client IP).

From looking at stats_t.php file I imagine this has to do with line 15:


//Set correct IP (Should be users, not the web server issuing the request)
    $t->setIp($_SERVER['REMOTE_ADDR']);

Any pointers?

On feedback:

From your instructions, I would change “(Replace example.org with your piwik install path)” for (Replace example.org/piwik with your piwik install path).

I suggest this because in my case I have piwik.example.org, and I am also a literal person, so when I read “Replace example.org” for your install, I am prone to enter http://piwik.example.org/piwik/…

It is a small detail and I imagine most people will figure it out before entering the url, but you asked for feedback, and well, your post is a tutorial

Thank you, very generous of you to share this gem,

Me