# Campaings and Users Raw data Export

Created: 21.02.2023&#x20;

Updated: 13.10.2023&#x20;

Author: Alexander Sugakov

## **Data Retrieval**

Data is exported uon request for a specific period to a folder with web authentication access. Separate files are created for each day within the folder. The export is done in CSV format (comma-separated).

One-time exports are stored in a subfolder <mark style="color:red;">**`/raw_data/`**</mark>.

Additionally, all clients have the option to enable automatic daily exports. Daily exports are stored in a subfolder <mark style="color:red;">**`/daily/`**</mark>. The data retention period for daily exports is 7 days, meaning that each day the data file from 8 days ago is deleted.

## **General Description**

The exported files contain a stream of data obtained from integrations. All data is structured in the form of a flat table, where various types of events are listed, each of events has its own set of properties.

There are 7 types of events in the data, identified by the numbers in the '<mark style="color:red;">`type`</mark>' column:

0 - Page View,

1 - Event Hit - an event sent to the platform,

2 - Variation Impression - impression of a variation,

3 - Variation Click - click on a variation (only for campaign types that track clicks),

4 - Widget Impression - impression of a recommendation widget,

5 - Product Impression - impression of a product in a recommendation widget,

6 - Product Click - click on a product in a recommendation widget.

7 - Visible Impression - campaign appearing in the user's viewport

## **Data Processing Recommendations**

Since all user interactions with customers’ entities (website, application, etc.) are stored as separate rows, to obtain a complete list of events for a client, it is necessary to filter events based on the '<mark style="color:red;">`uid`</mark>' column. To obtain a full list of a client's events within one session, you additionally need filter by the '<mark style="color:red;">`sessionId`</mark>' column.

Therefore, to obtain customer purchases attributed to a campaign, it is necessary to select all unique customer’s purchases (to avoid duplicates) made after the Variation Impression event with the corresponding '<mark style="color:red;">`variationId`</mark>' within the same session as the Variation Impression. You can use columns with campaigns, experiences, versions, and variations IDs and names to ideintify specific versions of specific campaigns.

It is recommended to analyze campaigns only within the scope of versions/tests. When changing experience settings or the distribution of users among variations (without adding/removing variations), all campaign IDs, experiences, and variations will remain unchanged. Only the version/test ID will change, but the distribution of variations among users will start anew, and the test concept itself may undergo significant changes.

We aslo typically recommend excluding [outliers](https://developer.gravityfield.ai/lang/en/analytics/outliers) from calculations.

## **Data Structure**

<table data-full-width="true"><thead><tr><th width="180">Field</th><th width="205">Type</th><th width="245">Value (default)</th><th>Description</th></tr></thead><tbody><tr><td>type</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/enum/">Enum8</a></td><td><p>0 - Page View, </p><p>1 - Event Hit, </p><p>2 - Variation Impression </p><p>3 - Variation Click </p><p>4 - Widget Impression </p><p>5 - Product Impression</p><p>6 - Product Click</p><p>7 - Visible Impression</p></td><td>User interaction type</td></tr><tr><td>contextType</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/enum/">Enum8</a></td><td></td><td>Type of the page from which the event was sent, in accordance with the Page Context</td></tr><tr><td>contextData</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/array">Array(String)</a></td><td></td><td>The contents of the array with context data</td></tr><tr><td>uid</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/fixedstring">FixedString(32)</a></td><td></td><td>Internal customer identifier (slid)</td></tr><tr><td>sec</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/fixedstring">FixedString(24)</a></td><td></td><td>Section ID</td></tr><tr><td>moscowTime</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/datetime">DateTime</a></td><td></td><td>Date and time of the event (by default in UTC+3)</td></tr><tr><td>sessionId</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/fixedstring">FixedString(32)</a></td><td>1234567890</td><td>Internal session identifier</td></tr><tr><td>url</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/string">String</a></td><td>"https://www.example.com/?url_params=123"</td><td>URL from which the event was sent</td></tr><tr><td>audiences</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/array">Array(FixedString(24))</a></td><td>[1234567, 9876543]</td><td>List of audience ID’s where user belonged at the moment the event was triggered</td></tr><tr><td>browser</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/lowcardinality/">LowCardinality(String)</a></td><td>"Safari”</td><td>User's browser type</td></tr><tr><td>device</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/lowcardinality/">LowCardinality(String)</a></td><td>"Tablet”</td><td>User's device type</td></tr><tr><td>os</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/lowcardinality/">LowCardinality(String)</a></td><td>"Mac OS X”</td><td>User's operating system type</td></tr><tr><td>cuid</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/string">String</a></td><td></td><td>Client’s customer ID</td></tr><tr><td>hashedEmail</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/fixedstring">FixedString(64)</a></td><td></td><td>SHA256 or MD5 hashed email from Login / Signup events (hash type can be different)</td></tr><tr><td>eventId</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/fixedstring">FixedString(32)</a></td><td>12345</td><td>Unique event ID for the purpose of deduplication</td></tr><tr><td>eventType</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/lowcardinality/">LowCardinality(String)</a></td><td>“add-to-cart-v1”</td><td>Preset event type (for OOTB events)</td></tr><tr><td>eventName</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/lowcardinality/">LowCardinality(String)</a></td><td>"Purchase"</td><td>Event name (human-readable)</td></tr><tr><td>eventProperties</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/string">String</a></td><td></td><td>Event properties</td></tr><tr><td>eventValue</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/int-uint">Uint32</a></td><td></td><td>Event value in cents, pence etc.</td></tr><tr><td>eventCurrency</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/lowcardinality/">LowCardinality(String)</a></td><td></td><td>Currency</td></tr><tr><td>uniqueTransactionId</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/string">String</a></td><td></td><td>Unique transaction identifier</td></tr><tr><td>eventCart</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/array">Array(Tuple[String, UInt32, UInt32])</a></td><td></td><td>Cart array</td></tr><tr><td>campaignId</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/fixedstring">FixedString(24)</a></td><td>123456</td><td>Campaign ID</td></tr><tr><td>experienceId</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/fixedstring">FixedString(24)</a></td><td>123456</td><td>Experience ID</td></tr><tr><td>versionId</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/fixedstring">FixedString(24)</a></td><td>123456</td><td>Test/version ID</td></tr><tr><td>variationId</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/array">Array(FixedString(24))</a></td><td>123456</td><td>Variation ID</td></tr><tr><td>campaignName</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/string">String</a></td><td>Campaign 1</td><td>Campaign name</td></tr><tr><td>experienceName</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/string">String</a></td><td>Experience 1</td><td>Experience name</td></tr><tr><td>versionName</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/string">String</a></td><td>Test 1</td><td>Test/version name</td></tr><tr><td>variationName</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/string">String</a></td><td>Variation 1</td><td>Variation name</td></tr><tr><td>control</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/nullable">Nullable</a></td><td>true</td><td>Indication that the current variation is a control group (baseline)</td></tr><tr><td>sku</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/array">Array(String)</a></td><td>[”12345”,”4567”]</td><td>Product SKU for view/click events in recommendations</td></tr><tr><td>strategyId</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/array">Array(FixedString(24))</a></td><td>[”126651”,”426356”]</td><td>Strategy ID (can be more than 1)</td></tr><tr><td>strategyName</td><td><a href="https://clickhouse.com/docs/en/sql-reference/data-types/string">String</a></td><td>Strategy 1</td><td>Strategy name (first in the list in case there are several)</td></tr></tbody></table>
