# Analytics

## Available Integrations

With our analytics integrations, Maxwell clients can track activity in the Borrower Hub. Our platform raises activity events which can be captured via through one of the following services:

1. [Google Tag Manager (GTM)](#google-tag-manager-gtm)
2. [Adobe Experience Platform Launch ](#adobe-experience-platform-launch)

In this document we describe the events that we track and provide basic instructions how to configure the analytics platforms that we integrate with.

## Maxwell Events

Following is a list of the analytics events that Maxwell tracks. Each event describes the data associated with it.

### **`Application Start`**

Fires whenever an anonymous application is created.

{% tabs %}
{% tab title="Event Dts" %}

```javascript
{
  event: 'maxwell-application-start',
  maxwellEvent: {
    action: 'start',
    category: 'application',
    label: undefined,
    value: undefined
  }
}
```

{% endtab %}
{% endtabs %}

### `Account Signup`

Fires whenever a borrower attempts to signup in *Auth0*.

{% tabs %}
{% tab title="Event Data" %}

```javascript
{
  event: 'maxwell-account-signup',
    maxwellEvent: {
      action: 'signup',
      category: 'account',
      label: undefined,
      value: undefined
    }
}
```

{% endtab %}
{% endtabs %}

### **`Account Login`**

Fires whenever a borrower attempts to login in *Auth0*.

{% tabs %}
{% tab title="Event Data" %}

```javascript
{
  event: 'maxwell-account-login',
  maxwellEvent: {
    action: 'login',
    category: 'account',
    label: undefined,
    value: undefined
  }
} 
```

{% endtab %}
{% endtabs %}

### `Task Start`

Fires whenever you click on a task for the first time. This event is always followed by a `Task View` event.

{% tabs %}
{% tab title="Event Data" %}

```javascript
{  
  event: 'maxwell-tasks-start',
  maxwellEvent: {
    action: 'start',
    category: 'tasks',
    label: TASK_KEY, // the blueprint task key as string
    value: undefined,
    applicationFileId: APP_ID, // the unique id of the application as string
    taskId: TASK_ID, // the unique task ID as number
    taskKey: TASK_KEY, // the blueprint task key as string
    taskTitle: TASK_TITLE // the task title as string
  }
}   
```

{% endtab %}
{% endtabs %}

### `Task View`

Fires whenever the borrower views a task. This event will also fire whenever the borrower starts  an application.

{% tabs %}
{% tab title="Event Data" %}

```javascript
{  
  event: 'maxwell-tasks-view',
  maxwellEvent: {
    action: 'view',
    category: 'tasks',
    label: TASK_KEY, // the blueprint task key as string
    value: undefined,
    applicationFileId: APP_ID, // the unique id of the application as string
    taskId: TASK_ID, // the unique task ID as number
    taskKey: TASK_KEY, // the blueprint task key as string
    taskTitle: TASK_TITLE // the task title as string
  }
}   
```

{% endtab %}
{% endtabs %}

### `Task Complete`

Fires whenever a task is completed.

{% tabs %}
{% tab title="Event Data" %}

```javascript
{  
  event: 'maxwell-tasks-complete',
  maxwellEvent: {
    action: 'complete',
    category: 'tasks',
    label: TASK_KEY, // the blueprint task key as string
    value: undefined,
    applicationFileId: APP_ID, // the unique id of the application as string
    taskId: TASK_ID, // the unique task ID as number
    taskKey: TASK_KEY, // the blueprint task key as string
    taskTitle: TASK_TITLE // the task title as string
  }
}   
```

{% endtab %}
{% endtabs %}

### `Field Change`

Fires whenever an enumerable field changes. Works for fields that involve a discrete choice as opposed to a free-text entry. Specifically, it works for the Maxwell field types of `BOOLEAN`, `CHECKBOX`, `CHOICE`, `CONSTANT`, `COUNTRY`, `DURATION`, `SELECT`, and `USSTATE`.

{% tabs %}
{% tab title="Event Data" %}

```javascript
{  
  event: 'maxwell-answer-set',
  maxwellEvent: {
    action: 'set',
    category: 'answer',
    label: FIELD_KEY, // the blueprint field key as string
    value: NEW_VALUE, // if number, otherwise undefined
    applicationFileId: APP_ID, // the unique id of the application as string
    taskId: TASK_ID, // the unique task ID as number
    taskKey: TASK_KEY, // the blueprint task key as string
    taskTitle: TASK_TITLE // the task title as string
    answerKey: FIELD_KEY, // the blueprint field key as string
    answerValue: NEW_VALUE,
  }
}   
```

{% endtab %}
{% endtabs %}

### `Pricing Option Selected`

Fires when the user selects a pricing option in the *Pricing Task*.

{% tabs %}
{% tab title="Event Data" %}

```javascript
{  
  event: 'maxwell-pricing-set',
  maxwellEvent: {
    action: 'set',
    category: 'pricing',
    label: TASK_KEY, // the blueprint task key as string
    value: undefined,
    productName: PRODUCT_NAME, // as string
    apr: APR, // as number or undefined
    rate: RATE, // as number or undefined
    price: PRICE, // as number or undefined
    applicationFileId: APP_ID, // the unique id of the application as string
    taskId: TASK_ID, // the unique task ID as undefined
    taskKey: TASK_KEY, // the blueprint task key as string
    taskTitle: TASK_TITLE // the task title as string
  }
}   
```

{% endtab %}
{% endtabs %}

### `Credit Scores Displayed`

Fires when the borrower’s credit report is complete and the scores are displayed to the borrower.

{% tabs %}
{% tab title="Event Data" %}

```javascript
{  
  event: 'maxwell-credit-show',
  maxwellEvent: {
    action: 'show',
    category: 'credit',
    label: TASK_KEY, // the blueprint task key as string
    value: undefined,
    scores: [
      {
        transunion: TR_SCORE, // as number or undefined
        equifax: EQ_SCORE, // as number or undefined
        experian: EX_SCORE, // as number or undefined
      }
    ],    
    applicationFileId: APP_ID, // the unique id of the application as string
    taskId: TASK_ID, // the unique task ID as undefined
    taskKey: TASK_KEY, // the blueprint task key as string
    taskTitle: TASK_TITLE // the task title as string
  }
}   
```

{% endtab %}
{% endtabs %}

### `Answer Push`

Fires whenever a borrower adds an item to a field of type `array` - this is a field that contains a list of items of the same kind, e.g. employers, dependents, assets, real estate owned,  etc.

{% hint style="danger" %}
Currently this event is supported only for the *Employers Task* when the borrower manually adds an employe&#x72;*.*
{% endhint %}

{% tabs %}
{% tab title="Event Data" %}

```javascript
{  
  event: 'maxwell-answer-push',
  maxwellEvent: {
    action: 'push',
    category: 'answer',
    label: FIELD_LABEL, // the label of the changed field as string      
    value: undefined,
    applicationFileId: APP_ID, // the unique id of the application as string
    taskId: TASK_ID, // the unique task ID as undefined
    taskKey: TASK_KEY, // the blueprint task key as string
    taskTitle: TASK_TITLE // the task title as string
    answerKey: FIELD_KEY, // the blueprint field key as string
    answerValue: NEW_VALUE,
  }
}   
```

{% endtab %}
{% endtabs %}

## Google Tag Manager (GTM)

{% hint style="success" %}

#### About Google Analytics (GA)

GA allows you to track a more limited set of the event data that we provide (even if funneled via GTM). To track all event data that we provide, you can use Google Tag Manager.&#x20;

GA can track only the following subset event data from the event `maxwellEvent` field:

```javascript
{
  action,
  category,
  label,
  value
  // all other data omitted
}
```

This is the same as calling the `sendEvent` method of the GA API: \
`analytics.sendEvent('category', 'action', { label: 'event label', value: 1 })`
{% endhint %}

1. Create a new account in [Google Tag Manager](https://tagmanager.google.com/). When you create it, a value will appear at the top left that starts with GTM-. This is the value you need to provide us after configuring everything in Google Tag Manager.

<figure><img src="https://lh7-us.googleusercontent.com/cIc_-of0oyzJff8QMfoKYHJ4N9lTelCN7cl8G5baDf6kPFUniInvBZqIUIFkrhAu0RZESnGFF_eaTFINGO3wfHx_ZBe5--vLZpgLQA1MttrHOhhbU0Py-ZMaYXR8kTYeIzqRjacDVk_HzBtfmeWhSiU" alt=""><figcaption></figcaption></figure>

2. Create a new Google Analytics account. And configure a data stream. At the end of the data stream setup, a new modal will appear with "Web stream details". There, on the right side you will see the "MEASUREMENT ID". Copy that value as we will need it later.&#x20;

{% hint style="info" %}
You can also verify this value by going to the bottom of Google Analytics, to Admin. There a new screen will appear with a section called "Data collection and modification". By clicking on "Data streams" you will be able to see that same ID.&#x20;
{% endhint %}

<figure><img src="https://lh7-us.googleusercontent.com/FUAhnXdY1LKbqeu8hD-L-JnmwUcmulih6rdXxauGZLCOaACunYTKED5MuXT6V1kVrbhRkqc8dG3B4Jz7EC0JpgRvUNmHF45n23Q5ez51kUvDSoYIXwdlzVLTwkhw5_FAI_HFN7o8mCfpzPa9p_y2GKs" alt=""><figcaption></figcaption></figure>

3. Now, it's time to configure the variables, triggers and tags in Google Tag Manager.

{% hint style="info" %}
Please note that this setting is for new customers only, as Google Tag Manager has changed. Old clients will maintain the same configuration, as Google took care of updating them automatically.
{% endhint %}

4. Create the following variables:

| Name          | Google Analytics Measurement ID |
| ------------- | ------------------------------- |
| Variable Type | Constant                        |
| Value         | MEASUREMENT ID (G-XXXXXXXXXX)   |

| Name                     | Maxwell Event Action  |
| ------------------------ | --------------------- |
| Type                     | Data Layer Variable   |
| Data Layer Variable Name | `maxwellEvent.action` |

| Name                     | Maxwell Event Category  |
| ------------------------ | ----------------------- |
| Type                     | Data Layer Variable     |
| Data Layer Variable Name | `maxwellEvent.category` |

| Name                     | Maxwell Event Label  |
| ------------------------ | -------------------- |
| Type                     | Data Layer Variable  |
| Data Layer Variable Name | `maxwellEvent.label` |

| Name                     | Maxwell Event Value  |
| ------------------------ | -------------------- |
| Type                     | Data Layer Variable  |
| Data Layer Variable Name | `maxwellEvent.value` |

6. Create the following Triggers:

| Name                   | Maxwell Event     |
| ---------------------- | ----------------- |
| Type                   | Custom Event      |
| Event Name             | maxwell\\-.+      |
| Use regex matching     | checked           |
| This triggers fires on | All Custom Events |

| Name                   | History Change      |
| ---------------------- | ------------------- |
| Type                   | History Change      |
| This triggers fires on | All History Changes |

6. Create the following Tags:

<table data-header-hidden><thead><tr><th width="358"></th><th></th></tr></thead><tbody><tr><td>Type</td><td>Google Analytics > Google Tag</td></tr><tr><td>Name</td><td>Maxwell - Google Analytics</td></tr><tr><td>Tag ID</td><td><code>{{Google Analytics Measurement ID}}</code></td></tr><tr><td>Triggering</td><td>Initialization - All Pages</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="358"></th><th></th></tr></thead><tbody><tr><td>Type</td><td>Google Analytics > Google Analytics: GA4 Event</td></tr><tr><td>Name</td><td>Maxwell - GA Event</td></tr><tr><td>Measurement ID</td><td><code>{{Google Analytics Measurement ID}}</code></td></tr><tr><td>Event Name</td><td><code>{{Event}}</code></td></tr><tr><td>Event Parameters</td><td><p><strong>event_category</strong><br>{{<code>Maxwelll Event Category}}</code></p><p></p><p><strong>event_action</strong><br>{{<code>Maxwell Event Action}}</code><br><br><strong>event_label</strong><br>{{<code>Maxwell Event Label}}</code><br><br><strong>value</strong><br>{{<code>Maxwell Event Value}}</code></p></td></tr><tr><td>Triggering</td><td>Maxwell Event</td></tr></tbody></table>

*If you are using legacy google analytics use these two tags instead*

<table data-header-hidden><thead><tr><th width="360"></th><th></th></tr></thead><tbody><tr><td>Name</td><td>Maxwell Page View - GA1</td></tr><tr><td>Type</td><td>Google Analytics: Universal Analytics (Legacy)</td></tr><tr><td>Track Type</td><td>PageView</td></tr><tr><td>Google Analytics Settings</td><td><code>{{Google Analytics Measurement ID}}</code></td></tr><tr><td>Triggering</td><td>All Pages, History Change</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="358"></th><th></th></tr></thead><tbody><tr><td>Name</td><td>Maxwell  - GA Event</td></tr><tr><td>Type</td><td>Google Analytics: Universal Analytics (Legacy)</td></tr><tr><td>Track Type</td><td>Event</td></tr><tr><td>Category</td><td><code>{{Maxwell Event Category}}</code></td></tr><tr><td>Action</td><td><code>{{Maxwell Event Action}}</code></td></tr><tr><td>Label</td><td><code>{{Maxwell Event Label}}</code></td></tr><tr><td>Value</td><td><code>{{Maxwell Event Value}}</code></td></tr><tr><td>Non-Interaction Hit</td><td>False</td></tr><tr><td>Google Analytics Settings</td><td><code>{{Google Analytics Measurement ID}}</code></td></tr><tr><td>Triggering</td><td>Maxwell Event</td></tr></tbody></table>

<br>

## Adobe Experience Platform Launch&#x20;

Once you complete your Launch setup, you will need to send us your Launch *Embed Code*, which will look similar to this:

```markup
<script src="https://assets.adobedtm.com/launch-ENa21cfed3f06f4ddf9690de8077b39e81-development.min.js" async></script>
```
