Home Laravel Pixel tracking code php example

Pixel tracking code php example

by Shahriar Sagor

Today now in this post i will show you pixel tracking code in php. pixel tracking technology is need when we want to give our commerce websites or something else that we need to give that site banner or need to add on another website. That time we can use pixel tracking technology because which we can help to count impressions. but if we want to use pixel tracking technology code in our website than we can do this by using following way.

So now in the bellow example i did create one banner image for my site products add. And here i will give html code for display to my site product banner in his site. So now in this example i will use pixel tracking technology for the impressions. So at first let’s give the following code as like this way. On this code we can put in the another websites.

Example HTML Code:

<a href="http://test.hd/adslink" target="_blank">
<img src="http://test.hd/getbanner.php?pid=1&token=yoRyH5" width="100px" height="100px">

So above html code we can use any our website as a banner or ads. But it is very important to track this code by using bellow code. So when above the html file code will run then that time it will track following file. so let’s see bellow.

Track By PHP file : getbanner.php

$ids = $_GET['pid'];
 $imagePath = "http://test.hd/banner/path.png";

 	$imagePath = "http://test.hd/banner/test.png";

 header('Content-Type: image/gif');
 echo readfile($imagePath);

Read Also : How to count number of files in directory PHP?

Thanks for read. I hope it help you. For more you can follow us on facebook.


You may also like