How to track events or actions

What are events?

LeadBoxer defines an event as a signal that is send to our service . An event can represent any type of activity, but usually is something that happens on a webpage that does not trigger a page load. For example a file download.

With the LeadBoxer Lead Pixel in place, you can track (log) any action or event in your web app or website.

The Lead Pixel contains functions and listeners that facilitate the insertion of events into LeadBoxer.

Examples

basic event

<script src="//script.leadboxer.com/?dataset=YourDatasetId"></script> 
<script type="text/javascript">    
	OTLogService.sendEvent("basic event"); 
</script>

Event with properties 

LeadBoxer does not only support custom events, but also adding  lead properties

<script src="//script.leadboxer.com/?dataset=YourDatasetId"></script> 
<script type="text/javascript">    
	var map = new OTMap();    
	map.put("firstName", "John");    
	map.put("lastName", "Doe");    
	OTLogService.sendEvent("my custom event", map); 
</script>

Track a PDF download link

To measure a click on a link that downloads a file, you can add a small piece of javascript to track this download:

<!-- Load the LeadBoxer javascript before you define the custom variable -->
<script src="//script.leadboxer.com/?dataset=YourDatasetId"></script> 
<script type="text/javascript">

function downloadlink(file) {
	var map = new OTMap();    
	map.put("PDF", file);
	OTLogService.sendEvent("Download", map, false); 

	// add 1 second delay so the event registers before downloading
	setTimeout(function() {
		window.location=file;
	},1000); 
}; 
</script>

<p><a href="#" onclick="downloadlink('mypdf.pdf');">Download PDF</a></p>
<p><input onclick="downloadlink('mypdf.pdf');" type="button" value="Download PDF" /></p>

Working example

A working example can be found here:  http://api.leadboxer.com/api/examples/log/index.html

Still need help? Contact Us Contact Us