---
title: Logging raw events
slug: experience/logging-raw-events
description: In Purple Apps, For a better understanding of what events are being logged in your App Analytics, it is possible to enable debug logging of raw tracking events.
docTags: 
createdAt: 2024-02-16T08:34:55.981Z
---

For a better understanding of what events are being logged in your App Analytics, it is possible to enable debug logging of raw tracking events.

:::hint{type="info"}
It is only possible to enable this feature on the **preview version** of a Purple App or Purple Website.
:::

## Prerequisites

::::Tabs
:::Tab{title="Web"}
There are no special requirements for web other than using a url with the preview=true parameter, i.e.&#x20;

- web.purplemanager.com/\<web\_newsstand\_slug>/\<path\_to\_a\_view>?preview=true
- \<custom\_domain>/\<path\_to\_a\_view>?preview=true

in the browser of the user's choice.&#x20;
:::

:::Tab{title="Android"}
To setup the feature in Android apps, the following requirements must be met

- a mobile device connected via USB with enabled developer options, see [Inspecting the Purple Experience in Android apps](docId:77jJExEefhigweNNBqcpP)
- Android Studio, see [https://developer.android.com/studio](https://developer.android.com/studio)
- Google Chrome
:::

:::Tab{title="iOS"}
To setup the feature in iOS apps, the following requirements must be met

- a device connected via USB with enabled safari inspector, see [Inspecting the Purple Experience in iOS apps](docId\:rPLgCYAqSDzZS9KbnM8hE)
- a mac OS device with Safari and the Console app
:::
::::

## Enabling and disabling logging

Open the web developer tools in your browser.

::::Tabs
:::Tab{title="Web"}
Depending on the browser, opening the developer tools might require different steps. Please see the documentation of the corresponding browser how to open them.
:::

:::Tab{title="Android"}
Assuming the prerequisites are met, perform the following steps:

1. install the preview app on the Android device
2. open the app and skip all dialogs until the initial view is rendered
3. connect it via usb
4. open chrome://inspect
5. select one of the views in the app

See [Inspecting the Purple Experience in Android apps](docId:77jJExEefhigweNNBqcpP) for more details.
:::

:::Tab{title="iOS"}
Assuming the prerequisites are met, perform the following steps:

1. install the preview app on the iOS device
2. open the app and skip all dialogs until the initial view is rendered
3. connect it via usb
4. open Safari on the mac OS device
5. in the menu in Develop
   1. select the iOS device
   2. select one of the views in the app

See [Inspecting the Purple Experience in iOS apps](docId\:rPLgCYAqSDzZS9KbnM8hE) for more details.
:::
::::

In the developer tools, open the console tab and paste the following line and then press enter:

```javascript
purple.tracking.debug({logging: true})
```

This setting is persisted and stays enabled even after app restarts or the page reloads until the same command is executed with the value *false* instead of *true*.

## Reading the logs

:::::Tabs
::::Tab{title="Web"}
:::hint{type="info"}
In web, these logs always start with \[TRACK], so to only show these tracking events, it is recommended to type \[TRACK] into the search field of the logs.
:::

The logs appear in the same console where the command to enable logging was executed.&#x20;
::::

::::Tab{title="Android"}
:::hint{type="info"}
On Android, these logs always have the tag TRACK. This can be later used for filtering.
:::

Logs are printed to Android's logcat. There are two ways to view these logs: Either the command line using adb or opening Android Studio with any project open and opening the logcat view.&#x20;

Ensure that the app is connected via usb and usb debugging is enabled.

**Using Android Studio:**

- open Android Studio
- open any project to start the whole editor
  - a sample project will suffice&#x20;
- in the menu, select View -> Tool windows -> Logcat
- on the top left, select the connected device
- enter tag\:TRACK to show only messages with such a tag
- optional: enter package:**\<packagename>** to limit these logs to the corresponding app where **\<packagename>** has to be replaced with the actual package name of the app.

**Using the command line:**

Open the Terminal app and run the following command:

```shell
adb logcat TRACK:D "*":S
```

This command reads all the logs that have the tag TRACK on debug level and will silence the rest. See [https://developer.android.com/tools/logcat](https://developer.android.com/tools/logcat#Syntax) for more details.
::::

::::Tab{title="iOS"}
:::hint{type="info"}
On iOS, these logs always have the category TRACK. This can be later used for filtering.
:::

Logs can be read using the Console app on mac OS. Ensure that the iOS device is connected with the mac OS device.

- open the Console app
- ensure that **Include Info Messages&#x20;**&#x69;s checked (Console App Menu -> Action -> Include Info Messages)
- select the device on the left side
- press on the start button to start reading logs
- type TRACK in the search field and press enter
- left of the new TRACK entry, tap on **any** and select Category
- optional: filter by app
  - enter the name of the app in the search field and press enter
  - left of the new app name entry, tap on **any** and select Process
  - Note: the app name is the last segment of the bundle identifier, i.e. com.sprylab.apps.**testing** would require to enter **testing** in the search field

![](https://api.archbee.com/api/optimize/ygR6KtT9QI_R0u3uKTJsm/plfscQfzy3qYA1sZgKW5D-20251210-164211.png)
::::
:::::

## Structure of the logs

The logs have the same structure on all platforms, it following this pattern:

:::BlockQuote
\[**TYPE**] **KEY** **PLACEHOLDERS**
:::

**TYPE** is one of **ACTION**, **VIEW**, **PURCHASE** and **ATTRIBUTE** which all correspond to the event types described in the following sections.

- [Action events](docId:8rrA4o7Vzdaw13Y-JOqEk)
- [View events](docId\:mIXE5-IjKbR47eUmMdyga)
- [Purchase events](docId\:mIxJ9wVzaLBAPWdBpAt29)
- [Attributes](docId\:dFUCRmFGqFURGuiv8nlTC)

**KEY** is the key of the event as described in the above sections.

**PLACEHOLDERS** are key-value pairs of the placeholders available for the given event and their corresponding values.

:::hint{type="info"}
Note that these events and their placeholders is just the raw data that is available and that does not mean that all those events are being sent to tracking services.&#x20;

This data is meant to visualise the options one can use to configure the tracking\_config.json, see [Tracking Configuration](docId\:SxKxO_OEPT7crFZZOB9Nw) and depending on that configuration and consent of the user, the final tracking data might be different.
:::

## Examples

::::Tabs
:::Tab{title="Web"}
Google Chrome developer tools:

![](https://api.archbee.com/api/optimize/ygR6KtT9QI_R0u3uKTJsm/al76MHhBOwBN93OTRC5Yx_image.png "Google Chrome developer tools")
:::

:::Tab{title="Android"}
Android Studio:

![Android Studio](https://api.archbee.com/api/optimize/ygR6KtT9QI_R0u3uKTJsm/OpO6hGgQ_Fy3O2UcS-gz4_image.png "Android Studio")

Command line:

![Command line](https://api.archbee.com/api/optimize/ygR6KtT9QI_R0u3uKTJsm/UctPt_Pct8wk6C3hD5VA9_image.png "Command line")


:::

:::Tab{title="iOS"}
Console app

![Console app](https://api.archbee.com/api/optimize/ygR6KtT9QI_R0u3uKTJsm/3kXnmLPnIPg4gcvvcIwCi_image.png)
:::
::::





