Skip to main content

This plugin counts keys provided in payload.

Project description

Key counter

This plugin counts key strings. Key string provided in configuration will be treated as an information to increase the value of a key in profile. This plugin can be used for simple statistics e.g. count how many user visited us on mobile device vs other devices like desktop or tablet.

Examples

For example if the key is a simple value and equals to:

[
  "a",
  "b",
  "a"
]

then the key count equals to

{
  "a": 2,
  "b": 1
}

If the key values are:

[
  {"key1": 1},
  {"key2": 2},
  {"key1": 2}
]

then the key will be increased by the provided value. Then key1 + 1, key2 + 2, and key1 + 2. And the result will be:

{
  "key1": 3,
  "key2": 2
}

You may also want to pass data the following way:

  {
    "key1": 1,
    "key2": 2
  }

This will also work and the result will be:

  {
    "key1": 1,
    "key2": 2
  }

Configuration

{
  "key": "desktop",
  "save_in": "profile@stats.counters.MobileVisits"
}

Example of configuration with dot notation in key and save_in

{
  "key": "event@session.context.browser.agent",
  "save_in": "profile@stats.counters.visits_origins"
}

Or with multiple key fields.

{
  "key": [
    "event@session.context.browser.agent",
    "event@session.context.browser.agent.string"
  ],
  "save_in": "profile@stats.counters.visits_origins"
}
  • key may be a string or a list of strings. Also, a dot notation can be used to access data.
  • save_in point to data in profile that will hold the information on key counts. It should be empty object {} or a key-value object. save_in holds the original data that will be incremented.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tracardi-key-counter-0.6.0.1.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

tracardi_key_counter-0.6.0.1-py3-none-any.whl (8.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page