How To Use Web Bug To Track User Online

Web bugs on Web page and Email

Bug bug (also known as Web beacons) is very important tools commonly used by online advertisers as marketing or advertisement analysis tool for tracking and monitoring the activity of users on a website or marketing content i.e: blog or email. An expert advertiser inserts, web bug in his content (usually on website and email) in order to track how many people opened a particular content, on which application and country his content is being viewed. So, whenever the advertisement display by third-party just know that you are being tracked for marketing and advertisement analysis purpose.

Web bug tools are provided freely or premium mostly by CRM service providers like Hubspot CRM, Freshsales CRM, Salesforce CRM and other Live customer support or Chat script service provider. However, a Web bug in PHP code can also be used for this tracking if tracking service by CRM provider is not available.

Information that a bug web tool delivers make hackers or security engineers use it as an information gathering tool. Whenever a visitor of a website or email recipient visits a website or open an email in which a Web bug PHP code is inserted, the Web bug will run and send information back to a website owner or email sender. In Web bug PHP code, information captured by the Web bug is stored directly into a database.

Information capture and store in database by Web bugs include:

  • IP address of the person who visits the web page or open the email
  • Application the person used to view the website or open the email
  • Date and Time when the web bug was viewed
  • The URL of the web page where the web bug is inserted

 

How to Insert and Use a Web bug on Web Page: Web bug PHP code can be placed or include in web page code. Simply place or include below php code in web page.

Step 1: Copy below code to create table in mysql database in your web server

CREATE TABLE IF NOT EXISTS `webbug` (
`id` int(10) unsigned NOT NULL auto_increment,
`ip` varchar(45) default NULL,
`host` varchar(255) default NULL,
`referrer` varchar(255) default NULL,
`date` date default NULL,
`time` time default NULL,
PRIMARY KEY (`id`),
KEY `index_2` (`date`),
KEY `index_3` (`time`)
) ENGINE=MyISAM AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1;

 

Step 2: Copy and save below php code as webbug.php in your web server

<?php
@ $db = new mysqli(‘localhost’, ‘user’,’password’, ‘database’);

if (mysqli_connect_errno()) {
//echo ‘Error: Could not connect to the database..’;
//exit;
}

if (!empty($_SERVER[‘REMOTE_ADDR’])) {
$ip = $_SERVER[‘REMOTE_ADDR’];
$host = gethostbyaddr($_SERVER[‘REMOTE_ADDR’]);
$referrer = $_SERVER[‘HTTP_REFERER’];
$date = date(“Y-m-d”);
$time = date(“H:i:s”);

$sql = “INSERT INTO webbug (id,ip,host,referrer,date,time) VALUES (null,’$ip’,’$host’,’$referrer’,’$date’,’$time’);”;

$db->query($sql);
}

?>

Step 3: Paste code or include code in your PHP code

Use php include method: include(“webbug.php”);  to include webbug.php file OR paste entire php code at the beginning of web page code.


 

How to Insert and Use a Web bug on Email: To insert a Web bug on email, there are two ways one can insert the Web bug on email (Text Link or Image loading method). Some emails service provide prevent automatic image and manually warn user to load the image in the page.  The image loading method is more common and repeatedly used than Text Linking.

Note: After creating webbug.php in a web server then use, url must look like: https://yourpage.net/tracking-or-whatever/webbug.php .

Copy url location of the Web bug and use it to redirect an image url to the webbug url OR embedd webbug url in a text link included in the email body.

Option 1: Image Loading method

Upload an image, namely webbug.gif file url will be: https://yourpage.net/tracking-or-whatever/webbug.gif and redirect it to the Web bug php file: webbug.php which url is: https://yourpage.net/tracking-or-whatever/webbug.php

Whenever webbug.gif file is load will always automatically redirect to webbug.php file. It is advisable to upload and use very small image as webbug.gif . When the image is loaded, the image will show and systemically redirect to webbug.php without loading any page but the image in the email.

webbug.gif image must be placed in body message of the email as: <img src="https://yourpage.net/tracking-or-whatever/webbug.gif" border="0" alt="" />

 

Option 2: Text Linking Method

Insert url in a text as a text link directly to page where a Web bug is running or included. So, when email recipient clicks on this link it redirects and open a page a Web bug inserted. This method is also known as phishing method used by malicious hackers to deceive victim into click of a text link redirect victim in loading a harmful program.

Web bug in email

 

 

Similar articles:

Importance of Web Browser Security

How To Secure Web Browser Against Cyber Attacks

 

 

Please follow and like us:

Olalekan Admin

Cyber Security Engineer