Developers guide

WP Tao has an easy API. Thanks to especially prepared links to actions and functions, other developers can easily integrate WP Tao with their own sites or create their own add-ons.

This section is successively updated. At the moment we are publishing information on how to register custom events you want to track and how to display the collected results in the WP Tao reports.

Custom events

WP Tao has severla in-built default events. Developers can easily add custom events that they want to track. Events which will be tracked can be triggered from PHP and JavaScript. Before the events are triggered, they must be registered. Learn how to register a custom event you want to track.

Events triggered from PHP

In order to store the information about the event, trigger the function do_action( 'wptao_track_event', $action, $args );, which assumes two parameters: the name of the event and an array of options. More information can be found in the article on creating custom events.

Triggering a function should take place at the right time. For example, if you want to track registering to a course, the action wptao_track_event should be triggered immediately after a proper validation of the subscription form.

If you have information about the user’s e-mail address when the event is triggered, you can make an attempt to identify him. This applies mainly to events related to forms.

Events triggered from JavaScript

WP Tao allows you to track events that are initiated on the side of the browser. Such events may include e.g. clicking on a particular HTML element. Information about the event can be saved by triggering the function wptaoEvent(action, value, tags) at the appropriate moment. If we want to save the information about clicking, wptaoEvent function should be triggered after clicking on the given element. For more information about creating custom events triggered from JavaScript, see the article JavaScript Events.