Introduction
There are three types of data points you should get familiar with:
- (E) Interactive Events,
- (M) Meta Events,
- (A) Attributes.
Both in the application and this documentation, data points are marked with a capital letter E, M or A (in brackets or in a circle) to make it clear what type of data point is being tracked, allowed in a query or just discussed.
(M) and (E) events describe everything that users do on your website. When they open pages (M) Section and (M) URL events are tracked. When the interact with elements on those pages, hover over content (E) mouseover, click buttons (E) click, or fill in form fields (E) change, these events are tracked with information about what exactly happened and when. Events can also describe how your website responded to user behavior, for example what form validation errors (M) Error were displayed upon submission of an incomplete form.
The same event can happen many times during the same visit as a user can click the same button twice or view the same page again.
This is what differentiates events from (A) attributes which are designed to store values that either don’t change during a visit (for example Browser, Country, Gender, Referrer) or, when they change, their final state is more important than changes to that state (for example Basket Value).
- (1) non-personal information about a user and a visit are tracked as attributes and include the randomly assigned (A) userID, the visit number userVisit, the dates and times of the current visit and of the (A) firstVisit, as well as (A) device, (A) platform, (A) browser among others.
- (2) information about the source of a visit is tracked as (A) referrer attribute allowing you to find out where the user came from. For direct entries (from bookmark or email client) the referrer value will be set to “none”.
- (3) the URL of the first page that the user opens during a visit is tracked as (A) entryURL. If URLs promoted in your campaigns contain params like “utm_source” to indicate the origin of a visit, you may use (A) entryURL instead of or alongside (A) referrer. The URL of the first visited page as well as URLs of other pages opened during the same visit are tracked as (M) URL meta events.
- (4) the part of a URL after a slash that follows the domain name is tracked as a (M) Section meta event. By default, it will include hash params (after #) but not search params (after ?).
- (5) all user interactions with page elements are tracked as (E) interactive events. For example when a user hovers a pointer over an element a (E) mouseover is tracked, and when the user clicks an element a (E) click event is tracked. Interactive events are tracked even when the user interacts with an element that has no interaction assigned, for example clicks on text instead of a link.
- (6) when a user clicks on a form field a (E) focus event is tracked. When the user selects the value or a field loses focus a (E) change event is tracked.
- (7) when a user submits a form, either by clicking a button or hitting an enter key, an (M) Action event is tracked.
- (8) tracking can be configured to track form validation messages as (M) Error meta events*.
- (9) screen resolution is saved as (A) screenWidth and (A) screenHeight.
- page content is not automatically tracked* but can be easily configured using Triggers. variables that are singular in a visit like (12) basket value, number of items in the basket should be tracked as (A) attributes; variables that can have multiple values in a visit like (11) the price of products that a user sees should be tracked as (M) meta events.
* the tracking code does not track any content that is displayed on the page, unless specifically configured to do so, in order to avoid unintended collection of personal or sensitive data.
(E) Interactive Events
Interactive events contain information about user interactions with the elements of your website: clicked buttons, hovered images, changed form values, etc.
Examples of interactive events:
- (E)
div[1]#checkout/a[1].button.continue.click
- (E)
select[1]#yearOfBirth.change( {val:”2003″} )
Interactive events are automatically collected by the UseItBetter script and formed based on the structure of your HTML and ids and classnames assigned to the elements on the page. The only way you can control how events are being captured is by modifying your website’s HTML code.
Understanding how (E) Interactive Events are formed and tracked is crucial to effective use of UseItBetter. You can learn more about this in a separate article.
If you are familiar with HTML, CSS and JavaScript, the syntax of (E) Interactive Events should be straightforward for you.
Similarities to CSS Selectors
The interactive events are very similar to standard CSS selectors that developers use to style the look of elements on a page or assign functions to them in JavaScript.
For example, here is a UseItBetter event consisting of a selector and event type click:
div[1]#checkout/a[1].button.continue.click
And here is a CSS selector referring to the same element:
div#checkout > a.button.continue { background: green; font-weight: bold; }
Finally, here is a JavaScript example using jQuery to assign the element a behavior for the click event:
$('div#checkout > a.button.continue').on('click', function(e) { // do something on click });
(M) Meta Events
Meta Events usually describe content the user is seeing, or the state of the user’s visit, for example:
- (M)
Section=Product/iPad Air
- (M)
Error=Invalid Phone Number on #mobilePhone
- (M)
ProductPrice = 329
but meta events can also contain information about key actions users take:
- (M)
Action=Submitted Form #registration
The examples above use three predefined meta events types that you should become familiar with: Section, Action and Error. You can also track your custom meta events using triggers or a JavaScript SDK method.
Saving Meta Events using JavaScript SDK API
uDash.saveMeta("key","value");
For example:
uDash.saveMeta("ProductPrice",330); uDash.saveMeta("ProductName","iPhone 6");
(A) Attributes
Examples of attributes:
- (A)
userVisit = 1
- (A)
browser = Google Chrome 32.2
- (A)
sex = female
- (A)
referrer = https://google.com
Every visit can have only one value for an attribute of the same key. If a user visits your website and it is their first visit, the value of the userVisit attribute will not change until they visit your website again.
If the same attribute is collected during a single visit more than once, only the last value will be associated with the visit and the previous values will be erased.
You can collect additional attributes using triggers or a JavaScript SDK API method.
Saving Attributes using the JavaScript SDK API
uDash.saveAttribute("key","value");
For example:
uDash.saveAttribute("Revenue",330); uDash.saveAttribute("New Customer",true);
Difference Between (M) Meta Events and (A) Attributes
Both Meta Events and Attributes have the same syntax and consist of a key/value pair. What makes them different is that Meta Events of the same key can have multiple values per visit and Attributes can have exactly one value.
For example, if you would like to track the basket value in a visit, you would save Basket Value every time the user adds or removes something from a basket.
If you use attributes and update the basket value during two visits:
Visit 1: | Visit 2 |
---|---|
(A) Basket Value = 0 (A) Basket Value = 100 (A) Basket Value = 70 |
(A) Basket Value = 0 (A) Basket Value = 50 (A) Basket Value = 0 |
only the last basket value would be preserved in those visits. Therefore if you sum the basket values, the total basket value in those two visits would be 70 (70 + 0).
If you save the same basket values as (M) meta events, all values would be preserved and the total basket value would be 230 (0 + 100 + 70 + 0 + 50 + 0).
In some cases, it can be useful to track the same values as both (M) meta events and (A) attributes. Such an approach would, for example, allow you to find visits in which users at some point had (M) basket value > 0
but at the end of a visit the (M) basket value = 0
.