Custom Events β
Custom events differ from custom dimensions as they signify that a particular action has occured
. The following is an illustrative examples of what might be considered a custom event:
- A User Logged In
- A User Purchased a Product
- A User was Presented with a Paywall
- A User was Asked to Subscribe
- A User unlocked an Achievement
- etc
Custom Event Properties β
A custom event my have some properties associated with it. These properties are treated as string values. For example, if your custom event was "purchased_product", a custom property might by "product_sku" with a value of "123456".
Reserved Properties / Metrics β
In addition to custom properties, there are a set of properties which when provided will act as custom metrics
. These reserved properties will not be treated as strings and must contain only numeric values.
List of reserved properties:
Property | Description |
---|---|
value | Any arbitrary numeric value to associate with the event |
score | A score to associate with an event |
shipping | A shipping amount (revenue value) to associate with the event |
tax | A tax amount (revenue value) to associate with the event |
revenue | A sales/revenue value to associate with the event |
Adding Custom Events β
To add a custom event you will call a javascript function from the gamera on page library at the time the event occurs on your site. The following examples demonstrate how to use custom events:
Example 1. - Custom event with custom properties
window.gamera = window.gamera || {};
window.gamera.cmd = window.gamera.cmd || [];
window.gamera.cmd.push(function() {
window.gamera.event("my-custom-event", {
"property-1": "test-value",
"property-2": "value1,value2,value3",
"score": 99
});
});
Example 2. - Tracking a user funnel
window.gamera = window.gamera || {};
window.gamera.cmd = window.gamera.cmd || [];
window.gamera.cmd.push(function() {
window.gamera.event("email_subscription_offered");
// or
window.gamera.event("email_subscription_accepted");
// or
window.gamera.event("email_subscription_rejected");
});