# Analytics

## Overview

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-5410dbcbdca9e9d0d9302777754adf663c3963a5%2Fimage.png?alt=media" alt="" width="375"><figcaption></figcaption></figure>

This guide will help you integrate an analytics solutions into your project, providing a self-serve way of collecting, extracting and evaluating user data.

We will be using [Mixpanel](https://docs.mixpanel.com/docs/what-is-mixpanel) as our example 3rd party analytics platform, but this approach should work for any analytics solution of your choice.

### Mixpanel

Mixpanel has a number of useful features that makes it an attractive option for any projects looking to track how their users interact with the platform, from their first visit to the webpage through to in-game events. A data point is represented as an [Event](https://docs.mixpanel.com/docs/what-is-mixpanel#events), which can contain a number of custom properties that you can define.

Each event is also associated with a unique [User](https://docs.mixpanel.com/docs/users), allowing you to analyse an individual user's or similarly grouped users' behaviour in a number of powerful ways.

One particularly powerful feature of Mixpanel is the ability to compute [Sessions](https://docs.mixpanel.com/docs/features/sessions) automatically via a timeout-based method.

Follow the guide below to learn about how you can start sending events to your own Mixpanel project via your Unreal Project, and via your external webpage!

## Setting Up Mixpanel Analytics

### Creating a Mixpanel Project

To get started, create a [mixpanel account](https://mixpanel.com/home/), where you will be prompted to set up your organization and first project. You should be met with a page like this on successful creation:

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-735b848da1630be04578acba8495d30d6ecf90a3%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Retrieving your Project Token

Before beginning implementation:

1. Ensure you have your [project token](https://developer.mixpanel.com/reference/project-token) to hand. This will be used at various points for authentication when trying to send events to mixpanel (specifically for web-based track events). You can find this under project settings:

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-c31f20a80519538c1de9ecf1dc806bdd9725c576%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Once retrieved, head to the [import events page](https://developer.mixpanel.com/reference/import-events) in mixpanel's docs. You should see section where you can paste your project token into the authorization.
3. When pasted, this will generate an authorization header of the form `Basic <base64-encoded string>` . Copy the base64 encoded value of your project token after "Basic", as you will need this when setting headers in your Unreal project.

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-39a29fb3d9d3720b11eaf3c738f0e5ac7cad50e8%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### Sending your first events to Mixpanel

To learn about sending events via your **web app**, check out:

* [send-events-from-web](https://docs.msquared.io/integrations/analytics/send-events-from-web "mention")

For sending events via your **Unreal project in Blueprints**, check out:

* [send-events-from-unreal](https://docs.msquared.io/integrations/analytics/send-events-from-unreal "mention")

### Viewing Data in Mixpanel

#### Events

Successfully sent events can be viewed immediately in the Events tab on Mixpanel. These will be sorted by time sent:

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-53c176efa50e5c7b1d53d1559dd3c306cb244027%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Users

You can also view users' profiles and their associated events here:

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-622f39f1d96d0ec0dc9a3db9f5d128bbca233a13%2Fimage.png?alt=media" alt=""><figcaption><p>All users with a profile will be displayed by default. You can filter for users who don't have a user profile in the top left, under Users</p></figcaption></figure>

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-b5b712f4a49607cbc2ac1cd0e046d2bbc900fa36%2Fimage.png?alt=media" alt=""><figcaption><p>Each user has an associated Activity Feed, listing all their events.</p></figcaption></figure>
