PepperHQ Developer

The PepperHQ Developer Hub

Hand crafted, customised and bespoke mobile experiences to suit your brand and needs.

Guides

Overview of Actions

Primer for the fundamental Action construct.

An Action is the Pepper internal representation (as data) of any ‘activity’ carried out by a User that may be ‘business relevant’. Examples of types of Actions include, amongst others; Sign-up, Check-in, Top-up, Pre-Order, Purchase and Refer-a-Friend.

Actions are the lifeblood of the Pepper service and are an important consideration across all areas of the product.

Actions have a data structure that is consistent between activity types and includes metadata and context that may be useful in Analytics, Rewards and other Marketing scenarios.

Actions contain the following information;

  • The Type of event - e.g. Signup, Top-up, Purchase, Pre-Order etc.
  • When the activity took place - including (but not limited to) the localized day-part (e.g. morning, lunch etc.), the day of the week and the exact time and date stamp.
  • Information about the User that performed the Action - including demographic information and the Audiences that they belong to (see Marketing section for a description of audiences).
  • Information about the Location at which the Action took place - including tags (e.g. ‘New Format Store’) and region (e.g. ‘City Central’).
  • Metadata describing the specific characteristics of the Action itself - such as the products involved in an Order, the card brand being added (e.g. ‘Visa’) or the value of a Top-up (including value-range and currency).

Additionally, in cases where an Action has an associated ‘value’ in terms of money or loyalty points; a ‘value range’ property is added. The range is based on the Fibonacci sequence of numbers - e.g. ‘0-1’, ‘1-2’, ‘2-3’, ‘3-5’, ‘5-8’, ‘8-13’ etc. This can be useful in analytics, rewards and marketing scenarios where the absolute value of an occurrence is not as useful as the range it is in.

Please follow the link below for the JSON Schema that describes an Action in detail.

Please see the sample below for an example of how an ORDER_CREATED Action is structured.

{
  "$schema": "http://schema.pepperhq.io/3.6/resources/Action/schema.json",
  "_id": "5729ae247b2d680013a4ecad",
  "type": "ORDER_CREATED",
  "environment": "PRODUCTION",
  "when": {
    "timestamp": "2016-01-01T08:00:00-08:00",
    "daypart": "MORNING",
    "dayofweek": 1,
    "dayofmonth": 1,
    "weekofyear": 1,
    "monthofyear": 0,
    "year": 2016
  },
  "context": {
    "user": {
      "id": "5729ae247b2d680013a4eca1",
      "name": "John Smith",
      "primary_platform": "IOS",
      "audiences": [
        {
          "audienceId": "5729ae247b2d680013a4eca2",
          "audienceTitle": "Loyal Customers"
        }
      ],
      "birth_date": "1972-08-15",
      "gender": "MALE"
    },
    "location": {
      "id": "5729ae247b2d680013a4eca3",
      "title": "Some Location",
      "regions": ["London", "South East"],
      "tags": ["Transverse"],
      "geo": [ -0.085958, 51.514556 ]
    },
    "tenant": {
      "id": "5729ae247b2d680013a4eca4",
      "title": "Some Tenant"
    },
    "tags": []
  },
  "metadata": {
    "orderId": "5729ae247b2d680013a4eca5",
    "basket": [
      {
        "title": "Flat White",
        "category": "Coffee",
        "price": {
          "amount": 2.8,
          "currency": "GBP",
          "range": "2-3"
        },
        "tags": ["Hot Drink"]
      }
    ],
    "basket_size": 1,
    "value": {
      "amount": 2.8,
      "currency": "GBP",
      "range": "2-3"
    }
  }
}