Skip to content

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:

PropertyDescription
valueAny arbitrary numeric value to associate with the event
scoreA score to associate with an event
shippingA shipping amount (revenue value) to associate with the event
taxA tax amount (revenue value) to associate with the event
revenueA 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

javascript
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

javascript
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");
});

Designed in America πŸ‡ΊπŸ‡Έ and Developed in Switzerland πŸ‡¨πŸ‡­