How to Refresh a JavaScript Conversion Tracking Pixel
Using the jQuery JavaScript language, you can refresh a tracking pixel. A tracking pixel must be contained within the DIV. The jQuery function refreshes the DIV and its pixel image without refreshing the entire page. This function lets you refresh tracking pixels for advertisement tracking. When the user opens the page, the tracking pixels refreshes and logs another page view for your site.
Instructions
-
-
1
Right-click the HTML file that contains the pixel and select "Open With." Click the preferred HTML or JavaScript editor for the file.
-
2
Locate the pixel image and wrap the tag within a DIV container. The following code is an example of a DIV container that wraps around a JPEG image:
<div id="tracking"><img src='pxl.jpg'></div>
-
-
3
Add the jQuery script to the page to refresh the DIV, which refreshes the pixel image. The following code refreshes the DIV when the browser loads the page:
<script>
var auto_refresh = setInterval(
function()
{
$('#tracking').load('pxl.jpg');
}
</script>
-
1