Realtime Dashboard Custom Metrics API

Custom Metrics will be shown in the Realtime Dashboard and allow users to customize their Realtime Dashboard.

Contents on this page

POST /realtime-dashboard-metric

Description

Create a custom metric

Endpoint

/realtime-dashboard-metric

Method

POST 

Parameters

NameTypeRequiredDescription
titlestringYThe name of the Custom Metric. This will be visible in the Realtime Dashboard. This must be url encoded.
typestringYThe type of data that will be measured. Can be either 'SUM' or 'AVG'.
display_typestringY

This will determine how the metric will be visualized. Possible options:

  • value_and_line (e.g. total events)
  • value (e.g. time on site)
  • gauge (e.g. scroll depth)
  • geo (e.g. total events world map)
  • line
settingsstringYJSON string. Possible options for this are explained below. This must be url encoded.

Data available

Created metrics will be available with data within minutes after creation.

Settings

The settings determine the rules for the metric, whether the metric should account for geo countries and if the metric should be aggregated per pixel, audience, campaign or advertiser.  An example can be found below.

NameTypeRequiredDescription
geo_aggregationbooleanYIf the metric should be counted per country
aggregate_byarrayY (can be empty)

Aggregation by a specific entity. Possible options:

  • pixel_id
  • audience_id
  • campaign_id
  • advertiser_id
rulesarrayYRules that should match this metric. Values in these rules can be comma-separated for multi-values.


  • Per geo-country data
  • Aggregate by pixel id and audience id
  • Rules:
    • Must be either event_type 1/2/3/6 or event_type 5 combined with interaction type 19.
    • Other possible options for comparator are:
      • 'equals' / '='
      • 'notequals' / '!='
      • 'contains'
      • 'doesnotcontains'
      • 'half'
      • 'end'
      • '>' (greater than)
      • '>=' (equal or greater than)
      • '<' (less than)
      • '<=' (equal or less than)
      • 'before'
      • 'between' 
      • 'after'
JSON
{
  "geo_aggregation": true,
  "aggregate_by": [
    "pixel_id",
    "audience_id"
  ],
  "rules": [
    {
      "comparator": "equals",
      "id": "event_type",
      "type": "dimension",
      "value": "1,2,3,6"
      "orRule": [
        {
          "comparator": "equals",
          "id": "event_type",
          "type": "dimension",
          "value": "5"
        },
        {
          "comparator": "equals",
          "id": "interaction_type",
          "type": "dimension",
          "value": "19"
        }
      ],
      "orRulesMatchAll": true
    }
  ]
} 


Full example

cURL example
curl -X POST \
	--header "X-Auth: auth_token_here_after_auth" \
	--header "X-CSRF: csrf_token_here_after_auth" \
	"https://platform.flxone.com/api/realtime-dashboard-metric?settings=%7B%22geo_aggregation%22%3Atrue%2C%22aggregate_by%22%3A%5B%22pixel_id%22%2C%22audience_id%22%5D%2C%22rules%22%3A%5B%7B%22comparator%22%3A%22equals%22%2C%22id%22%3A%22event_type%22%2C%22orRule%22%3A%5B%7B%22comparator%22%3A%22equals%22%2C%22id%22%3A%22event_type%22%2C%22type%22%3A%22dimension%22%2C%22value%22%3A%225%22%7D%2C%7B%22comparator%22%3A%22equals%22%2C%22id%22%3A%22interaction_type%22%2C%22type%22%3A%22dimension%22%2C%22value%22%3A%2219%22%7D%5D%2C%22orRulesMatchAll%22%3Atrue%2C%22type%22%3A%22dimension%22%2C%22value%22%3A%221%2C2%2C3%2C6%22%7D%5D%7D&title=pim_from_json_test123&type=sum&display_type=value_and_line"

Please refer to the section authentication for the auth and csrf tokens.