Configuration: Enrich event data
10min
summary this article is about the enrichment of your event data that can be done by using placeholders and by adding parameters to your event configuration this article is structured as follows configuration enrich event data docid\ vexp4mbwybjar50smsx1t describes what placeholders are and how to find out which ones are available for your event configuration enrich event data docid\ vexp4mbwybjar50smsx1t describes how placeholders are used within your " tracking config json " and how these values are replaced configuration enrich event data docid\ vexp4mbwybjar50smsx1t describes where to add placeholders in your event configuration configuration enrich event data docid\ vexp4mbwybjar50smsx1t shows the whole process of using placeholders, replacing them with concrete values and finally looking at the data sent to the tracking service placeholders templates and parameters may contain placeholders within the value part and are referenced in the „ tracking config json “ by using the following syntax {{placeholder name}} {{placeholder name}} placeholder names are always uppercased and separated by underscores example issue id issue id a list of all available placeholders can be found in chapter placeholder docid\ hwgaxh6bt5orbprp0v9vg please note, however, that not all placeholders are available for every event based on the documentation of a specific event, the available placeholders are always linked within the " placeholder " tab if none are available, this is marked accordingly placeholder template engine the placeholder template engine replaces the placeholder with its associated value, which is only available and known at app runtime this means, for example, that the values of content are only available for tracking when an app user has an issue or article opened the replacement of the placeholders is done before the event data is sent to the backend of the tracking service you can add placeholders in the value area of templates and parameters, which are described below templates and parameter template the first place placeholders can be used is within a template most events only make sense if placeholders are used in the templates however, these can only be used in the value area of the template as a reminder, the structure of a template within the „ tracking config json “ is as follows " template key template key " " value of template value of template “ short example the template may be „ action action “ „ issue opened issue opened “ and enriched by a placeholder „ action action “ „ issue opened {{issue id}} issue opened {{issue id}} “ parameter some tracking services supports to send additional data with your event to the tracking service back end which is done by parameters which is a list of key/value pairs it is useful to add parameters to your events it is recommend to define your use cases first then select the corresponding event(s) and have a look of the available placeholders finally derive a list of useful parameters and add them to the event configuration as a reminder, the structure of a parameter within the „ tracking config json “ is as follows " parameter key parameter key " " value of parameter value of parameter “ short example the parameter may be „ issue id issue id “ „ static parameter value may be useless static parameter value may be useless “ and enriched by a placeholder „ issue id issue id “ „ {{issue id}} {{issue id}} “ example in the example you will find two variants of a " tracking config json " at the end, one with some events completely without data enrichment and one with data enrichment for example, let's take the following event issue downloaded "issue downloaded" { "templates" { "action" "issue downloaded" } } without data enrichment, later evaluation of events in the respective front end of your tracking service is more than difficult the " issue downloaded issue downloaded " event as shown does not provide any information about which issue was downloaded all you see is that x app users have downloaded y issues it therefore makes sense to enrich your events with additional data the above event could look like this issue downloaded "issue downloaded" { "templates" { "action" "issue downloaded" }, "parameters" { "issue id" "{{issue id}}", "issue name" "{{issue name}}", "issue categories" "{{issue categories}}", "issue tags" "{{issue tags}}", "issue purchasable" "{{issue purchasable}}", "issue purchased" "{{issue purchased}}", "publication id" "{{publication id}}", "publication name" "{{publication name}}" } } advantages for your evaluation you know the number of downloads per issue you could create download statistics per issue is that issue purchasable? etc purple's recommendation for naming parameter names when naming parameters, we recommend using the name of the placeholder in lowercase as the parameter name example if you are interested in the issue name and want to use the placeholder " issue name issue name ", then create a parameter with the key " issue name issue name " the parameter could therefore look like this " issue name issue name " "{{ issue name issue name }}" the transmission to your tracking service will then take place as follows for a “ may 2023 may 2023 ” edition " issue name issue name " " may 2023 may 2023 " tracking config json example code without enrichment { "default" { "events" {}, "views" {}, "purchases" {}, "attributes" {} }, "airship" { "events" { "storefront issue bookmark added" { "templates" { "action" "issue bookmark added" } }, "issue downloaded" { "templates" { "action" "issue downloaded" } }, "storefront search performed" { "templates" { "action" "search performed" } } }, "views" { "app menu" { "templates" { "name" "app menu" } } }, "purchases" { "storefront subscription purchased" { "templates" { "action" "subscription purchased" } } }, "attributes" { "has active subscription" { "templates" { "name" "has active subscription" }, "parameters" { "tag group" "subscriptions" } } } }, "firebase" { "events" { "storefront issue bookmark added" { "templates" { "action" "issue bookmark added" } }, "issue downloaded" { "templates" { "action" "issue downloaded" } }, "storefront search performed" { "templates" { "action" "search performed" } } }, "views" { "app menu" { "templates" { "name" "app menu" } } }, "purchases" {}, "attributes" { "has active subscription" { "templates" { "name" "has active subscription" } } } } } example code enriched { "default" { "events" {}, "views" {}, "purchases" {}, "attributes" {} }, "airship" { "events" { "storefront issue bookmark added" { "templates" { "action" "issue bookmark added" }, "parameters" { "view" "{{view}}", "bookmark title" "{{bookmark title}}", "bookmark description" "{{bookmark description}}", "bookmark page label" "{{bookmark page label}}", "bookmark creation date" "{{bookmark creation date}}", "issue id" "{{issue id}}", "issue name" "{{issue name}}", "issue categories" "{{issue categories}}", "issue tags" "{{issue tags}}", "issue purchasable" "{{issue purchasable}}", "issue purchased" "{{issue purchased}}", "issue product id" "{{issue product id}}", "publication id" "{{publication id}}", "publication name" "{{publication name}}" } }, "issue downloaded" { "templates" { "action" "issue downloaded" }, "parameters" { "issue id" "{{issue id}}", "issue name" "{{issue name}}", "issue categories" "{{issue categories}}", "issue tags" "{{issue tags}}", "issue purchasable" "{{issue purchasable}}", "issue purchased" "{{issue purchased}}", "publication id" "{{publication id}}", "publication name" "{{publication name}}" } }, "storefront search performed" { "templates" { "action" "search performed" }, "parameters" { "view" "{{view}}", "phrase" "{{phrase}}" } } }, "views" { "app menu" { "templates" { "name" "app menu" } } }, "purchases" { "storefront subscription purchased" { "templates" { "action" "subscription purchased" }, "parameters" { "transaction id" "{{transaction id}}", "subscription product id" "{{product id}}", "subscription price" "{{price}}", "subscription price currency" "{{currency code}}", "subscription id" "{{subscription id}}", "subscription name" "{{subscription name}}", "subscription type" "{{subscription type}}", "subscription duration" "{{subscription duration}}", "subscription price formatted" "{{subscription price}}", "subscription purchased" "{{subscription purchased}}" } } }, "attributes" { "has active subscription" { "templates" { "name" "has active subscription" }, "parameters" { "tag group" "subscriptions" } } } }, "firebase" { "events" { "storefront issue bookmark added" { "templates" { "action" "issue bookmark added" }, "parameters" { "view" "{{view}}", "bookmark title" "{{bookmark title}}", "bookmark description" "{{bookmark description}}", "bookmark page label" "{{bookmark page label}}", "bookmark creation date" "{{bookmark creation date}}", "issue id" "{{issue id}}", "issue name" "{{issue name}}", "issue categories" "{{issue categories}}", "issue tags" "{{issue tags}}", "issue purchasable" "{{issue purchasable}}", "issue purchased" "{{issue purchased}}", "issue product id" "{{issue product id}}", "publication id" "{{publication id}}", "publication name" "{{publication name}}" } }, "issue downloaded" { "templates" { "action" "issue downloaded" }, "parameters" { "issue id" "{{issue id}}", "issue name" "{{issue name}}", "issue categories" "{{issue categories}}", "issue tags" "{{issue tags}}", "issue purchasable" "{{issue purchasable}}", "issue purchased" "{{issue purchased}}", "publication id" "{{publication id}}", "publication name" "{{publication name}}" } }, "storefront search performed" { "templates" { "action" "search performed" }, "parameters" { "view" "{{view}}", "phrase" "{{phrase}}" } } }, "views" { "app menu" { "templates" { "name" "app menu" } } }, "purchases" {}, "attributes" { "has active subscription" { "templates" { "name" "has active subscription" } } } } }