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 Lets assume the following configuration:
{
"key": "payload@value",
"save_in": "[email protected]"
}
if over time the value in payload (defined in config as payload@value) is equals to:
or value in payload is a list of
then the key count equals to
and will be saved in [email protected]
If the payload values are:
then the key will be increased by the provided value. Then key1 + 1, key2 + 2, and key1 + 2. And the result will be:
You may also want to pass data the following way:
This will also work and the result will be:
Configuration
{
"key": "desktop",
"save_in": "[email protected]"
}
Example of configuration with dot notation in key and save_in
{
"key": "[email protected]",
"save_in": "[email protected]_origins"
}
Or with multiple key fields.
{
"key": [
"[email protected]",
"[email protected]"
],
"save_in": "[email protected]_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.