Welcome to the DEMO & EXAMPLES web site for Open Web Analytics. The data contained in the demos and examples comes from the live usage of this site. Historical data is truncated periodically.

Action Event Tracking

This example page shows how to log actions that users make on your web site. An action is any interaction worth counting that is not a page view — a download, a video play, a form submission, a click on a call to action.

After the tracker has loaded, owa_cmds is a live command queue rather than a plain array — anything pushed to it is executed immediately, which is why the link above works on click and not only at page load.

Here's the Javascript used to track an action event:

var owa_baseUrl = 'https://domain.com/path/to/owa/';
var owa_cmds = owa_cmds || [];
owa_cmds.push(['setSiteId', '__YOUR_SITE_ID__']);
owa_cmds.push(['trackPageView']);
owa_cmds.push(['trackClicks']);

// Log an action as the page loads.
owa_cmds.push(['trackAction',
	'Demo',                 // action group - required. how actions are bucketed in reports
	'Page Loaded',          // action name  - required. the action itself
	'Action Events Page',   // action label - optional. free-form context
	1                       // numeric value - optional. counts, scores, durations
]);

// Or log one in response to something the visitor does.
document.getElementById('my-download-link').onclick = function() {
	owa_cmds.push(['trackAction', 'Downloads', 'Whitepaper', 'Q3 Pricing Guide']);
};

(function() {
	var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true;
	_owa.src = owa_baseUrl + 'public/base/dist/owa.tracker.js';
	var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);
}());

Actions appear under the Action Tracking reports, grouped by the action group and name you choose.