Legacy Analytics: Raw Data Export

Overview

Unity Analytics Raw Data Export gives you full access to raw event data. This lets you use the data in whatever way you choose, for example to construct custom queries or data visualizations.

There are two ways you can access raw data export:

  • The Unity Analytics dashboard user interface
  • By calling the REST API

Raw Data Export provides data from June 2016 onwards.

Analytics dashboard user interface

The Unity Analytics dashboard provides a way to export and access your raw event data without writing any code. In your Unity Analytics dashboard (analytics.cloud.unity3d.com), select your project and navigate to Analytics > Raw Data Export.

Follow these steps in the Export section:

  1. Specify the Data Set you want to export (such as appRunning, appStart, custom, deviceInfo, or transaction).
  2. Specify the Start Date, or alternatively continue exporting data from a previous job by selecting the Previous Job Id from the drop-down box.
  3. Specify the End Date.
  4. The file format defaults to JSON. Specify your preferred file format by clicking on and selecting an item from the drop-down menu under Export as JSON.

The Export section and Activity table on the Raw Data Export screen

Raw Data Export automatically creates the job and displays it in the Activity table on the screen.

Once the job is done, you can download your data by selecting the files from the Download column.

REST (Representational State Transfer) API

Every data point sent to Unity Analytics is stored in Unity's data store. The Raw Data Export APIs allow you to download your raw event data in files as the data is received and stored.

Requirements

Every request requires HTTP Basic authentication using your Unity Project ID (UPID) and API Key.

Limitations

  • The request period (startDate to endDate) is limited to 31 days.
  • Limits to usage may be subject to change.
  • Unity Analytics retains the raw data files generated for a request for 14 days. (To access the data after 14 days has elapsed, make a new request.)

User workflow

To export raw data, call the Create Raw Data Export API. This request triggers an asynchronous job to process the data. The time this takes depends on how much data is being exported.

To get the current status or result, poll using the Get Raw Data Export API. Once the export is completed, you can get the result in the response of this API. The result contains the list of files and the corresponding download URLs. You can loop through the URLs and download the exported data.

Notes:

  • All dates and times in requests or responses are in the UTC timezone.
  • API requests or responses use the JSON format (which is formatted for readability in this document). The data file format is configurable.
  • Data is exported in .gzip compressed files.
  • The URL base for the API is https://analytics.cloud.unity3d.com.

Create Raw Data Export

A Raw Data Export is specific to a project and specific to a single dataset (event type). The request period is limited to 31 days.

Use the following HTTP method to create a Raw Data Export:

POST api/v2/projects/{UNITY_PROJECT_ID}/rawdataexports

Arguments are provided in the payload of the request, and are in JSON format with the Content-Type application/json.

Request argumentRequired or optionalTypeDescription
startDateRequired unless continueFrom is specifiedstringThe start date (inclusive) of the export. The date is expressed in YYYY-MM-DD format (ISO-8601).
endDateRequiredStringThe end data (exclusive) of the export. The date is expressed in YYYY-MM-DD format (ISO 8601). This is the date at which to close the query. When searching for the current day, use the following day’s date.
formatRequiredStringThe output data format: json (newline-delimited json) or tsv.
datasetRequiredStringOne of the following event types: appStart, appRunning, deviceInfo, custom, or transaction.
continueFromOptionalStringThe Raw Data Export ID to continue exporting data from. This is used for continuing a previous export from the point it finished. See Continuing for more information. Instead of specifying a startDate, a prior Raw Data Export ID could be specified in continueFrom. It is an error to specify both continueFrom and startDate.

Template for a request using cURL on the command line:

curl --user {UNITY_PROJECT_ID}:{API_KEY} --request POST --header "Content-Type: application/json" --data {REQUEST_JSON}
https://analytics.cloud.unity3d.com/api/v2/projects/{UNITY_PROJECT_ID}/rawdataexports

Example values:

UNITY_PROJECT_ID = aa43ae0a-a7a7-4016-ae96-e253bb126aa8
API_KEY = 166291ff148b2878375a8e54aebb1549
REQUEST_JSON = { "startDate": "2016-05-15" , "endDate": "2016-05-16", "format": "tsv", "dataset": "appStart" }

An actual request using the example values:

curl --user aa43ae0a-a7a7-4016-ae96-e253bb126aa8:166291ff148b2878375a8e54aebb1549 --request POST --header "Content-Type: application/json" --data '{ "startDate": "2016-05-15" , "endDate": "2016-05-16", "format": "tsv", "dataset": "appStart" }' https://analytics.cloud.unity3d.com/api/v2/projects/aa43ae0a-a7a7-4016-ae96-e253bb126aa8/rawdataexports

The response uses the common Raw Data Export Response Attributes in JSON format.

Raw Data Export Response Attributes

Response attributeTypeDescription
idStringThe Raw Data Export ID.
upidStringThe Unity Project ID.
createdAtStringThe created time in ISO 8601 format.
statusstringThe current status of the export. Possible values are: running, completed, or failed.
durationLongThe time it took to export data (in milliseconds).
requestJsonThe request arguments.
resultJsonThe result contains attributes that detail the exported data. The result is only available after the export is successfully completed. See below for result attributes.
result.sizeLongThe total size of the data exported (in bytes).
result.eventCountLongThe total number of events exported.
result.intraDayBooleanWhen the request includes the current day it might not contain all the data for the day. This attribute is TRUE if the data is incomplete for the last day.
result.fileListJsonThe list of files containing the data exported. The file list is empty when there is no data.
result.fileList.nameStringThe file name.
result.fileList.urlStringThe download URL for the file. The files are compressed in gzip format.
result.fileList.sizeLongThe size of the file in bytes.
result.fileList.dateStringThe file contains events for this specific date. This date is based on the submit time of the event. There may be multiple files for the same date. The date in is in ISO 8601 format.

An example of response:

{  
   "id":"8228d1e9-31b3-4a5e-aabe-55d9c8afa052",
   "upid":"beff3f49-b9ed-41a4-91ea-677e9b85e71e",
   "createdAt":"2016-05-10T10:10:10.100+0000",
   "status":"running",
   "duration" : 0,
   "request":{  
      "startDate":"2016-05-01",
      "endDate":"2016-05-02",
      "format":"json",
      "dataset":"appRunning"
   }
}

Continue creating from a prior Raw Data Export

When you are running periodic Raw Data Exports, you must provide the continueFrom argument instead of the startDate to make sure you are continuing from the previous Raw Data Export. Prior Raw Data Export IDs can be fetched via the GET APIs or accessed via the Dashboard.

Prior Raw Data Exports in the Unity Analytics Project Dashboard

Get Raw Data Export

Use the following HTTP method to get a specific Raw Data Export or ongoing export status:

GET api/v2/projects/{UNITY_PROJECT_ID}/rawdataexports/{raw_data_export_id}

All required arguments are part of the URL path.

An example of a request:

curl --user {UNITY_PROJECT_ID}:${API_KEY} https://analytics.cloud.unity3d.com/api/v2/projects/{UNITY_PROJECT_ID}/rawdataexports/${ID}

The response is the Raw Data Export in JSON format. It is the same as the response in Create Raw Data Export.

An example of a response:

{  
   "id":"6601f70e-6a0b-48ed-909f-26711af82b49",
   "status":"completed",
   "createdAt":"2016-05-21T04:41:54.000+0000",
   "duration":8631714000,
   "request":{  
      "startDate":"2016-02-11T00:00:00.000+0000",
      "endDate":"2016-03-11T00:00:00.000+0000",
      "format":"tsv",
      "dataset":"custom"
   },
   "result":{  
      "size":78355,
      "eventCount":17473,
      "fileList":[  
         {  
            "name":"headers.gz",
            "url":"https://uca-export.s3.amazonaws.com/staging/devTest/custom/appid%3DUNITY_PROJECT_ID/jid%3D6601f70e-6a0b-48ed-909f-26711af82b49/headers.gz?AWSAccessKeyId=AKIAJUXGNF66F4XPWSWA&Expires=1463872651&Signature=PnzIeeI%2FNxSOlKkLVpLcfK%2FxVpU%3D",
            "size":105
         },
         {  
            "name":"part-4b0cf376-3478-4bc8-845e-f73aff5c0be4.gz",
            "url":"https://uca-export.s3.amazonaws.com/staging/devTest/custom/appid%3DUNITY_PROJECT_ID/jid%3D6601f70e-6a0b-48ed-909f-26711af82b49/part-4b0cf376-3478-4bc8-845e-f73aff5c0be4.gz?AWSAccessKeyId=AKIAJUXGNF66F4XPWSWA&Expires=1463872651&Signature=xZk3%2BzQNTQ6yjK2Mh%2FaH338ABn8%3D",
            "size":78250,
            "date":"2016-02-13T00:00:00.000+0000"
         }
      ],
      "intraDay":false
   }
}

List all Raw Data Exports

Use this HTTP method to get the list of all Raw Data Exports for a specific project:

GET api/v2/projects/{UNITY_PROJECT_ID}/rawdataexports

All required arguments are part of the URL path.

An example of a request:

curl --user {UNITY_PROJECT_ID}:${API_KEY} https://analytics.cloud.unity3d.com/api/v2/projects/${UNITY_PROJECT_ID}/rawdataexports/

The response is a list of Raw Data Exports in JSON format. See Raw Data Export Response Attributes for the definition of each export list element.

An example of a response:

[
{  
   "id":"6601f70e-6a0b-48ed-909f-26711af82b49",
   "status":"completed",
   "createdAt":"2016-05-21T04:41:54.000+0000",
   "duration":8631714000,
   "request":{  
      "startDate":"2016-02-11T00:00:00.000+0000",
      "endDate":"2016-03-11T00:00:00.000+0000",
      "format":"tsv",
      "dataset":"custom"
   },
   "result":{  
      "size":78355,
      "eventCount":17473,
      "fileList":[  
         {  
            "name":"headers.gz",
            "url":"https://uca-export.s3.amazonaws.com/staging/devTest/custom/appid%3DUNITY_PROJECT_ID/jid%3D6601f70e-6a0b-48ed-909f-26711af82b49/headers.gz?AWSAccessKeyId=AKIAJUXGNF66F4XPWSWA&Expires=1463872651&Signature=PnzIeeI%2FNxSOlKkLVpLcfK%2FxVpU%3D",
            "size":105
         },
         {  
            "name":"part-4b0cf376-3478-4bc8-845e-f73aff5c0be4.gz",
            "url":"https://uca-export.s3.amazonaws.com/staging/devTest/custom/appid%3DUNITY_PROJECT_ID/jid%3D6601f70e-6a0b-48ed-909f-26711af82b49/part-4b0cf376-3478-4bc8-845e-f73aff5c0be4.gz?AWSAccessKeyId=AKIAJUXGNF66F4XPWSWA&Expires=1463872651&Signature=xZk3%2BzQNTQ6yjK2Mh%2FaH338ABn8%3D",
            "size":78250,
            "date":"2016-02-13T00:00:00.000+0000"
         }
      ],
      "intraDay":false
   }
},
{  
   "id":"6601f70e-6a0b-48ed-909f-26711af82b48",
   "status":"completed",
   "createdAt":"2016-05-21T04:41:54.000+0000",
   "duration":8631714000,
   "request":{  
      "startDate":"2016-02-11T00:00:00.000+0000",
      "endDate":"2016-03-11T00:00:00.000+0000",
      "format":"tsv",
      "dataset":"custom"
   },
   "result":{  
      "size":78355,
      "eventCount":17473,
      "fileList":[  
         {  
            "name":"headers.gz",
            "url":"https://uca-export.s3.amazonaws.com/staging/devTest/custom/appid%3DUNITY_PROJECT_ID/jid%3D6601f70e-6a0b-48ed-909f-26711af82b48/headers.gz?AWSAccessKeyId=AKIAJUXGNF66F4XPWSWA&Expires=1463872651&Signature=PnzIeeI%2FNxSOlKkLVpLcfK%2FxVpU%3D",
            "size":105
         },
         {  
            "name":"part-4b0cf376-3478-4bc8-845e-f73aff5c0be4.gz",
            "url":"https://uca-export.s3.amazonaws.com/staging/devTest/custom/appid%3DUNITY_PROJECT_ID/jid%3D6601f70e-6a0b-48ed-909f-26711af82b48/part-4b0cf376-3478-4bc8-845e-f73aff5c0be4.gz?AWSAccessKeyId=AKIAJUXGNF66F4XPWSWA&Expires=1463872651&Signature=xZk3%2BzQNTQ6yjK2Mh%2FaH338ABn8%3D",
            "size":78250,
            "date":"2016-02-13T00:00:00.000+0000"
         }
      ],
      "intraDay":false
   }
}
]

TSV format

If you choose to export in TSV format, the headers are provided in a separate file in headers.gz. The data files do not include headers.

An example headers file:

ts	appid	type	userid	sessionid	platform	sdk_ver	debug_device	user_agent	submit_time	name	custom_params

Dataset

Each of the six data types (event types) differ. See below for their schema definitions.

Notes:

  • ts is the timestamp at which the event was generated on the device. Note that device-generated timestamps can be skewed due to the device clock and latency in receiving the event.
  • submit_time is the timestamp at which the event was received by Unity Analytics.
  • If a field in a record has no data, the value of that field is set to the default value for the data type of the field (0 for numbers, "" for strings, and false for bools). Nested fields, like the IAP TransactionEvent.receipt field, in JSON-format exports are an exception to this policy. In the JSON-format export of nested fields, any fields containing no data are not included in the JSON object for that record.

AppStart event

{
   "namespace":"com.unity.analytics.commons.schema",
   "name":"AppStartEvent",
   "type":"record",
   "fields":[
       {"name": "ts",   "type": "long", "default": 0}, 
       {"name": "appid", "type": "string", "default": ""},
       {"name": "type", "type": "string", "default": ""}, 
       {"name": "userid", "type": "string", "default": ""},
       {"name": "sessionid", "type": "string", "default": ""},
       {"name": "platform", "type": "string", "default": ""},
       {"name": "sdk_ver", "type": "string", "default": ""},
       {"name": "debug_device", "type": "boolean", "default": false},
       {"name": "user_agent", "type": "string", "default": ""},
       {"name": "submit_time", "type": "long", "default": 0} 
   ]
}

AppRunning event

{
   "namespace":"com.unity.analytics.commons.schema",
   "name":"AppRunningEvent",
   "type":"record",
   "fields":[
       {"name": "ts",   "type": "long", "default": 0}, 
       {"name": "appid", "type": "string", "default": ""},
       {"name": "type", "type": "string", "default": ""},
       {"name": "userid", "type": "string", "default": ""},
       {"name": "sessionid", "type": "string", "default": ""},
       {"name": "platform", "type": "string", "default": ""},
       {"name": "sdk_ver", "type": "string", "default": ""},
       {"name": "debug_device", "type": "boolean", "default": false},
       {"name": "user_agent", "type": "string", "default": ""},
       {"name": "submit_time", "type": "long", "default": 0}, 
       {"name": "duration", "type": "int", "default": 0}
   ]
}

Custom event

{
   "namespace":"com.unity.analytics.commons.schema",
   "name":"CustomEvent",
   "type":"record",
   "fields":[
       {"name": "ts",   "type": "long", "default": 0}, 
       {"name": "appid", "type": "string", "default": ""},
       {"name": "type", "type": "string", "default": ""},
       {"name": "userid", "type": "string", "default": ""},
       {"name": "sessionid", "type": "string", "default": ""},
       {"name": "platform", "type": "string", "default": ""},
       {"name": "sdk_ver", "type": "string", "default": ""},
       {"name": "debug_device", "type": "boolean", "default": false},
       {"name": "user_agent", "type": "string", "default": ""},
       {"name": "submit_time", "type": "long", "default": 0}, 
       {"name": "name", "type": "string", "default": ""},
       {
           "name":"custom_params",
           "type":["null",{
               "type":"map",
               "values": ["string","null"],
               "default": ""
           }],
           "default": null
       }
   ]
}

DeviceInfo event

{
   "namespace":"com.unity.analytics.commons.schema",
   "name":"DeviceInfoEvent",
   "type":"record",
   "fields":[
       {"name": "ts",   "type": "long", "default": 0}, 
       {"name": "appid", "type": "string", "default": ""},
       {"name": "type", "type": "string", "default": ""}, 
       {"name": "userid", "type": "string", "default": ""},
       {"name": "sessionid", "type": "string", "default": ""},
       {"name": "platform", "type": "string", "default": ""},
       {"name": "sdk_ver", "type": "string", "default": ""},
       {"name": "debug_device", "type": "boolean", "default": false},
       {"name": "user_agent", "type": "string", "default": ""},
       {"name": "submit_time", "type": "long", "default": 0}, 
       {"name": "debug_build", "type": "boolean", "default": false},
       {"name": "rooted_jailbroken", "type": "boolean", "default": false},
       {"name": "processor_type", "type": "string", "default": ""},
       {"name": "system_memory_size", "type": "string", "default": ""},
       {"name": "make", "type": "string", "default": ""},
       {"name": "app_ver", "type": "string", "default": ""},
       {"name": "license_type", "type": "string", "default": ""},
       {"name": "app_install_mode", "type": "string", "default": ""},
       {"name": "model", "type": "string", "default": ""},
       {"name": "engine_ver", "type": "string", "default": ""},
       {"name": "os_ver", "type": "string", "default": ""},
       {"name": "app_name", "type": "string", "default": ""},
       {"name": "timezone", "type": "string", "default": ""},
       {"name": "ads_tracking", "type": "boolean", "default": false}
   ]
}

Transaction event

{
   "namespace":"com.unity.analytics.commons.schema",
   "name":"TransactionEvent",
   "type":"record",
   "fields":[
       {"name": "ts",   "type": "long", "default": 0},
       {"name": "appid", "type": "string", "default": ""},
       {"name": "type", "type": "string", "default": ""},
       {"name": "userid", "type": "string", "default": ""},
       {"name": "sessionid", "type": "string", "default": ""},
       {"name": "platform", "type": "string", "default": ""},
       {"name": "sdk_ver", "type": "string", "default": ""},
       {"name": "debug_device", "type": "boolean", "default": false},
       {"name": "user_agent", "type": "string", "default": ""},
       {"name": "submit_time", "type": "long", "default": 0},        {
           "name":"receipt",
           "type":["null",{
               "type":"record",
               "name": "receiptRecord",
               "fields":[
                   {"name": "data", "type": "string", "default": ""},
                   {"name": "signature", "type": "string", "default": ""}
               ]
           }],
           "default": null
       },
       {"name": "currency", "type": "string", "default": "USD"},
       {"name": "amount", "type": "float", "default": 0},
       {"name": "transactionid", "type": "long", "default": 0},
       {"name": "productid", "type": "string", "default": ""}
   ]
}

Dictionary

Data fieldDefinitionDataset
tsThe timestamp (in milliseconds) at which the event was generated on the device. Note that device-generated timestamps can be skewed due to the device clock and latency in receiving the eventAll datasets
appidThe ID that is assigned to each app on the Unity Analytics DashboardAll datasets
typeThe type of event being queried (i.e. Custom, DeviceInfo, Transaction, etc)All datasets
useridUnity Analytics generated identifier for a useridAll datasets
sessionidUnity Analytics generated identifier for the session. If a game is reopened after more than 30 minutes of inactivity, a new session ID is generatedAll datasets
remote_ipThe IP address that the session was played from. Note that this field has been removed and is no longer availableNot used
platformThe platform that the session was played onAll datasets
sdk_verVersion of Unity Analytics SDK that is being used for this event. If the sdk_ver begins with a "u" then it is from the Analytics tool built engine. Otherwise, it is from the Analytics plugin for Unity versions older than 5.2All datasets
debug_deviceA boolean that shows whether the event was sent from a development build. Set to TRUE for events coming from Unity EditorAll datasets
user_agentThe User-Agent request-header fieldAll datasets
submit_timeThe timestamp (in milliseconds) at which the event was received by Unity AnalyticsAll datasets
durationThe duration (number of seconds) that this session has been running for, calculated by the SDKAppRunning
nameThe name of the Custom Event (e.g. “LevelComplete”)Custom
custom_paramsThe list of Custom Event parameters and their corresponding values.Custom
receiptIncludes data returned by platform app stores, such as App Store and Google PlayTransaction
currencyThe currency code for the payment (eg. USD, EUR, CAD, etc) in ISO 4217 codeTransaction
amountThe total decimal amount of currency spentTransaction
transactionidUnique identifier for this transaction, set by SDK. Each transaction is given a unique ID, not to be confused with the store’s transaction IDTransaction
productidThe store-specific product identifier of an in-app purchase (eg. com.mygame.100coins)Transaction
debug_buildA boolean that shows whether the event was sent from a development build. Set to TRUE for events coming from Unity EditorDeviceInfo
rooted_jailbrokenA boolean that is set to TRUE in case of rooted / jailbroken phone not sent for normal phoneDeviceInfo
processor_typeDevice processor typeDeviceInfo
system_memory_sizeDevice system memoryDeviceInfo
makeMaker of the device (eg. "OSXEditor")DeviceInfo
app_verVersion of the application (eg. "1.0")DeviceInfo
deviceidA unique device identifier. Note that this field has been removed and is no longer available.Not used
license_typeType of license (eg. “advanced_pro”)DeviceInfo
app_install_modeTells if app is installed via app store ("store"), adhoc ("adhoc"), developer install ("dev_release"), simulator ("simulator") or enterprise ("enterprise")DeviceInfo
modelDevice model (eg. "MacBookPro11,3")DeviceInfo
engine_verUnity engine version (eg. "5.5.0a3")DeviceInfo
os_verOS Version (eg. "Mac OS X 10.11.5")DeviceInfo
app_nameBundle identifier or package name (eg. "com.Company.ProductName")DeviceInfo
timezoneISO code (eg. “GMT-7”)DeviceInfo
ads_trackingA boolean value that indicates whether the user has limited ad trackingDeviceInfo
adsidAdvertising Id. On iOS, collected when Unity Ads is enabled. On Android, all the time. Note that this field has been removed and is no longer available.Not used