Track custom actions

Go beyond pageviews and track very specific activities including Signups, Payments, Logins etc…

Woopra also allows you to track Custom Events in addition to simple pageviews. Let’s say you are running a website that allows a user to perform an action without having to reload the whole page. You can track these actions using Woopra’s Custom Events.

Important: The attribute name of each custom event is required. It will be used to identify the nature of the custom events. (e.g. payment, transaction, signup, subscription, cart, etc…)

In order to send custom event data to Woopra it should be added before the javascript snippet and formatted in the following manner:

<script type="text/javascript">

function woopraReady(tracker){
	tracker.setDomain('yourdomain.com');
	tracker.setIdleTimeout(300000);

	tracker.pushEvent({
		name: 'signup', // required
		username: 'johnsmith',
		company: 'Woopra, Inc.'
	});

	return false;
}

(function(){
var wsc=document.createElement('script');
wsc.type='text/javascript';
wsc.src=document.location.protocol+'//static.woopra.com/js/woopra.js';
wsc.async=true;
var ssc = document.getElementsByTagName('script')[0]; 
ssc.parentNode.insertBefore(wsc, ssc);
})();
</script>  

The code above will track a custom event titled “signup”, and provides some more information like the username and company of the
account created. Just imagine all of the custom events that can be tracked on your website: add creditcard, add comment, request demo, ad click, etc…

What’s even more important about custom events is that you can always run custom reports about the data you pass to Woopra, so for the example given above, you could get the number of signups by company.

Custom URL Tracking (With optional custom meta data)

If you wish to track the full page URL (containing query part), or to add custom event-level data to the page view, your script would follow this format:

<script type="text/javascript">
function woopraReady(tracker){
	tracker.setDomain('yourdomain.com');
	tracker.setIdleTimeout(300000);

	tracker.trackPageview({
		url: window.location.pathname + window.location.search,
		title: document.title,
		author: 'John Doe',
		category: 'Technology'
	});

	return false;
}

(function(){
var wsc=document.createElement('script');
wsc.type='text/javascript';
wsc.src=document.location.protocol+'//static.woopra.com/js/woopra.js';
wsc.async=true;
var ssc = document.getElementsByTagName('script')[0]; 
ssc.parentNode.insertBefore(wsc, ssc);
})();
</script>  

Custom Events on mouse click (or other events)

Woopra allows to send custom events after the page has loaded, and on certain events you wish to track.ex:

someElement.onclick = function() {
	woopraTracker.pushEvent({
		name: 'Event Name',
		artist: 'Dave Brubeck',
		song: 'Take Five'
	}); 
};