General Information


Purple DS Apps provide the option to customise your tracking parameters to your individual needs.

It's up to you, whether you just want to set a bookmark or record all available parameters. 


In this article we will explain how to connect to the tracking service Google Firebase. If you are using another tracking service and need further assistance, please contact us!



Instructions


01 What is being tracked?

In Firebase three large groups are recorded within the tracking. Depending on the tracking service this can vary, but here we focus on Google Firebase.


Events/Actions

The values in this group are used to record the actions of users, for example, whether an issue has been downloaded or a bookmark has been set. Parameters passed to Firebase are defined here as "action".



Views

This group captures the views or screens on which the user is or was located. For example, you can record whether a user has seen the app menu, is in his expenditure overview or has been on a page in the content. Parameters passed to Firebase are defined here as "name".



Attributes

The last group reports the status of a user, for example, whether the user has an active subscription. Parameters passed to Firebase are also defined as "name".


In our technical documentation we have listed all values for you.


02. parameter settings

Purple DS apps record several native parameters for each of the events in the three groups mentioned above. They differ of course, depending on the tracked event. When tracking which content the user is reading, parameters such as the issue name or page title are important. When tracking coupon redemption, the coupon code is recorded as a parameter.


In the technical documentation these are called template placeholders.





03. the configuration of the tracking file

To configure the transmitted tracking information to Google Firebase, Purple DS uses a tracking file called tracking_config.json.

Depending on the number of values you want to track, this file can be several hundred lines long.


For easier editing you should use an editor like Brackets or Atom.



The file structure


In the screenshot below, you can see the enclosing container of the tracking file (red lines). Between the two red lines the settings are made.



Activate your custom tracking


If you want to activate your custom tracking, the first thing to do is to prevent the default data from being transmitted. This is done by adding the following block, where all values must be set to "false". If the values are set to "true" all default values are also transmitted.




Configuring an Action Event


We now want to track our individualised event that records the adding of a bookmark. 

The default value for the bookmark in the "events" area looks like this:



Now we'll look at this paragraph line by line


The Event


This value must not be changed, because your Purple App uses this unique parameter to send the registered value to the tracking service. 


Activating the event



With this line and the value "true", you activate the event and send the collected information to the tracking service.


Defining an "Action


This value is very important. It is the name that will later show in Firebase Analytics as a plain text value for the event. By default "app_bookmark_added" is used here, but you can rename this value to "Bookmark created" for example. 



Setting the parameters

Eventually you can set the parameters for the respective event. Here we have 2 areas that can be adjusted.


  • Parameter names (Template Placeholders)

  • Attributes


In our example with the bookmarks we currently have the following parameters:


  • content_id (The ID of the publication or issue is used here which is an automatically generated hash term like "ch84jfhufdg8544hfnghb-fnug4")

  • content_name (display name of the issue)

  • bookmark_section (section of the content where the bookmark was set)

  • bookmark_title (Assigned name of the bookmark)


These parameters may be renamed and will later show in Firebase within the Action Event. 



The attributes linked to the parameter are placed in curly brackets behind it and can be extended with additional text.


Here is an example:

Let's say we want to edit the standard parameter: "bookmark_title": "{{BOOKMARK_TITLE}}" by adding the following explanatory text: "Reader has set a bookmark". Also bookmark_title shall be renamed to "Bookmark_Name".


The edited line will then look like this:


"Bookmark_Name": "Reader has set a bookmark {{BOOKMARK_TITLE}}"


With a click on the event, in our case "BOOKMARK_ADDED" the parameters appear in the detail view of the event in Firebase.





Not every Purple Event has linked parameters that can be sent. The APP_START event, for example, does not transmit any parameters (since they are not required here).


Validating the changes


If you adjust tracking_config.json, it can quickly happen that an error creeps in and breaks the file. To avoid searching for a needle in a haystack, you can either use a validation plugin (e.g. Json Lint) or have the code validated on an external site such as https://jsonformatter.curiousconcept.com/.


The finished tracking_config.json will be integrated into the dynamic content of the app on the top level of the default folder. 


If differing values need to be tracked for Android and iOS, two files must be created here.