TheDeveloper
TheDeveloper

Reputation: 940

Custom Pixel tracking code to track user activity or stats

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

Upvotes: 1

Views: 2547

Answers (1)

KIKO Software
KIKO Software

Reputation: 16741

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.

Upvotes: 1

Related Questions