1

I'm in process of developing a pixel tracking code , that will sit on external websites (checkout confirmation page). Pixel tracking is currently done using a image tag which calls a PHP file.

Background scenario:

  1. User A visits a page on my site, click on a link ( A product).
  2. User taken to external site - product page
  3. User then click buy now and proceeds to checkout.
  4. Once checkout process is completed pixel tracking called at the end.

I need to know how i can track the following stats or data for each unique/individual user :

  1. Track the page the users left or exit
  2. Track what page user landed on
  3. Track if user made the purchase for that item or not
TheDeveloper
  • 890
  • 1
  • 15
  • 37
  • Piwik probably already does all this - can you use that rather than developing from scratch? It is essentially Google Analytics that you can host yourself. – halfer Aug 31 '14 at 12:37
  • @halfer i prefer using my own method since i understand the process more, Im not to sure how i would integrate Piwik. – TheDeveloper Aug 31 '14 at 15:08
  • It's extremely easy. You host it like any other web app, set up some simple configuration, and then you put their tracking pixel on your website using the full domain address. It is much, _much_ easier than writing your own, by a long shot. – halfer Aug 31 '14 at 21:54
  • @halfer Can Piwik create pixel code, which i can give out to online stores? – TheDeveloper Sep 02 '14 at 19:42

1 Answers1

1

You must have access to the external website, and be able to change their code. Otherwise, it is not, and obviously should not be, possible.

So, you put your pixel on all their pages. With that pixel you can send information to the server you do the tracking on. For instance the page the pixel is on. Suppose your pixel is:

http://www.mypixeltracking.com/mypixel.php

You can add data to that by using arguments:

http://www.mypixeltracking.com/mypixel.php?id=2723252&page=/home.html

Your mypixel.php PHP script can pick this up and put it in a database. That's the basic idea. You can add the arguments on the external server with JavaScript or in their codes.

You might still wonder how you make a pixel in PHP? See here: Developing a tracking pixel

The types of tracking you want to do can be done by looking at the information in your database.

Community
  • 1
  • 1
KIKO Software
  • 15,283
  • 3
  • 18
  • 33
  • how do i identify or track each user? should I set a cookie with user's IP address? – TheDeveloper Aug 31 '14 at 20:18
  • IP addresses won't do, they change or are shared. A cookie is a good idea, as long as it contains a unique session id. It's not perfect however, for instance when a single customer uses more than one computer or erases the cookie. There are clever ways to identify them as the same, for instance after a login, but do you want to go that far? See: http://stackoverflow.com/questions/138670/how-unique-is-the-php-session-id – KIKO Software Aug 31 '14 at 20:29