Version: 2019.2
User Attributes (Atributos de Usuario)
Restablecimiento de datos

Unity Analytics Raw Data Export (Exportación de datos sin procesar)

Información General

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.

Then follow these steps in the Export section of that screen:

  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
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

Cada punto de dato enviado a Unity Analytics se almacena en la tienda de datos de Unity. Las Raw Data Export APIs le permiten a usted descargar sus datos de eventos sin procesar en archivos a medida que los datos se reciben y se almacenan.

Requerimientos

Cada consulta requiere una autenticación básica HTTP utilizando su Unity Project ID (UPID) y API Key.

Limitaciones

  • 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.)

Flujo de trabajo del usuario

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.

Notas:

  • Todas las fechas y tiempo en las solicitudes o respuestas están en la zona horario UTC.
  • Las solicitudes o respuestas de la API utilizan el formato JSON (el cual es formateado para facilitar la lectura en este documento). El formato del archivo de datos es configurable.
  • Los datos se exportan en archivos comprimidos .gzip.
  • La URL base para la API es 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.

Utilice el método HTTP siguiente para crear Raw Data Export:

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

Los argumentos se proporciona en la payload de la solicitud, y están en formato JSON con el Content-Type application/json.

Request argument Requerido u opcional Tipo Descripción
startDate Requerido al menos de que continueFrom se especifique cadena La fecha inicial (inclusivo) de la exportación. La fecha está expresa en el formato YYYY-MM-DD (ISO–8601).
endDate Required String La fecha final (exclusiva) de la exportación. La fecha está expresada en el formato YYYY-MM-DD (ISO 8601). Esta es la fecha en la cual se cierra la consulta. Cuando busque por el día actual, utilice la fecha del día siguiente.
format Required String The output data format: json (newline-delimited json) or tsv.
dataset Required String One of the following event types: appStart, appRunning, deviceInfo, custom, or transaction.
continueFrom Optional String El Raw Data Export ID para continuar exportando datos. Este es utilizado para continuar una exportación previa del punto en el que termino. Mirar Continuing para más información. En vez de especificar una startDate, un Raw Data Export ID se puede especificar en continueFrom. Es un error especificar ambos continueFrom y 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

Valores ejemplo:

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" }

Una solicitud actual utilizando los valores ejemplo:

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

La respuesta utiliza los Raw Data Export Response Attributes en formato JSON.

Raw Data Export Response Attributes (Atributos de respuesta de la exportación de los datos sin procesar)

Response attribute Tipo Descripción
id String El Raw Data Export ID.
upid String El Unity Project ID.
createdAt String El tiempo creado en formato ISO 8601.
status cadena El estado actual del reporte. Los valores posibles son: running (ejecutando), completed (completado), or failed (fallo).
duration Long El tiempo que tomo para exportar los datos (en mili-segundos).
request Json Los argumentos de solicitud.
result Json El resultado contiene atributos que detallan los datos exportados. El resultado solamente está disponible después de que la exportación haya completado exitosamente. Mirar abajo para los atributos de resultado.
result.size Long El tamaño total de los datos exportados (en bytes).
result.eventCount Long El número total de eventos exportados.
result.intraDay Boolean When 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.fileList Json La lista de archivos que contienen datos exportados. La lista de archivos es vacía cuando no hay datos.
result.fileList.name String El nombre del archivo.
result.fileList.url String El URL de descarga para el archivo. Los archivos son comprimidos en formato gzip.
result.fileList.size Long El tamaño del archivo en bytes.
result.fileList.date String El archivo contiene eventos para esta fecha específica. Esta fecha se basa en el tiempo de envío del evento. Puede haber varios archivos para la misma fecha. La fecha está en formato ISO 8601.

Un ejemplo de una respuesta:

{  
   "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"
   }
}

Continúe creando desde una Raw Data Export previa

Cuando usted esté ejecutando Raw Data Exports periódicamente, usted debe proporcionar el argumento continueFrom en vez del startDate para asegurarse que continúa del previo Raw Data Export. Los Raw Data Export IDs se pueden recuperar vía las APIs GET o se acceden vía la Dashboard (tabla de comandos).

Raw Data Exports previos en la Unity Analytics Project Dashboard
Raw Data Exports previos en la Unity Analytics Project Dashboard

Get Raw Data Export

Utilice el siguiente método HTTP para obtener un Raw Data Especifico o la situación en curso de exportación:

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

Todos los argumentos requeridos son parte de la ruta del URL.

Un ejemplo de una solicitud:

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

La respuesta es el Raw Data Export en formato JSON. Es el mismo que la respuesta en Create Raw Data Export.

Un ejemplo de una respuesta:

{  
   "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
   }
}

Liste todos los Raw Data Exports

Utilice este método HTTP para obtener la lista de todos los Raw Data Exports de un proyecto específico:

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

Todos los argumentos requeridos son parte de la ruta del URL.

Un ejemplo de una solicitud:

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

La respuesta es una lista de Raw Data Exports en formato JSON. Mirar la Raw Data Export Response Attributes para la definición de cada elemento de la lista exportado.

Un ejemplo de una respuesta:

[
{  
   "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
   }
}
]

Formato TSV

Si usted escoge exportar en formato TSV, los encabezados son proporcionados en un archivo separado en headers.gz. Los archivos de datos no incluyen encabezado.

Un archivo de encabezado ejemplo:

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

Dataset (conjunto de datos)

Cada uno de los seis tipo de datos (tipos de evento) difieren. Mirar abajo para las definiciones de sus esquemas.

Notas:

  • ts es el timestamp (marca del tiempo) en el que el evento fue generado en el dispositivo. Tenga en cuenta que los timestamps generados por el dispositivo pueden estar sesgados al reloj del dispositivo y latencia al recibir el evento.
  • submit_time es el timestamp (marca de tiempo) en el cual el evento fue recibido por 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 field Definition (Definición) Dataset
ts The 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 event All datasets
appid The ID that is assigned to each app on the Unity Analytics Dashboard All datasets
type The type of event being queried (i.e. Custom, DeviceInfo, Transaction, etc) All datasets
userid Unity Analytics generated identifier for a userid All datasets
sessionid Unity Analytics generated identifier for the session. If a game is reopened after more than 30 minutes of inactivity, a new session ID is generated All datasets
remote_ip The IP address that the session was played from. Note that this field has been removed and is no longer available Not used
platform The platform that the session was played on All datasets
sdk_ver Version 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.2 All datasets
debug_device A boolean that shows whether the event was sent from a development build. Set to TRUE for events coming from Unity Editor All datasets
user_agent The User-Agent request-header field All datasets
submit_time The timestamp (in milliseconds) at which the event was received by Unity Analytics All datasets
duration The duration (number of seconds) that this session has been running for, calculated by the SDK AppRunning
name The name of the Custom Event (e.g. “LevelComplete”) Custom
custom_params The list of Custom Event parameters and their corresponding values. Custom
receipt Includes data returned by platform app stores, such as App Store and Google Play Transaction
currency The currency code for the payment (eg. USD, EUR, CAD, etc) in ISO 4217 code Transaction
amount The total decimal amount of currency spent Transaction
transactionid Unique identifier for this transaction, set by SDK. Each transaction is given a unique ID, not to be confused with the store’s transaction ID Transaction
productid The store-specific product identifier of an in-app purchase (eg. com.mygame.100coins) Transaction
debug_build A boolean that shows whether the event was sent from a development build. Set to TRUE for events coming from Unity Editor DeviceInfo
rooted_jailbroken A boolean that is set to TRUE in case of rooted / jailbroken phone not sent for normal phone DeviceInfo
processor_type Device processor type DeviceInfo
system_memory_size Device system memory DeviceInfo
make Maker of the device (eg. “OSXEditor”) DeviceInfo
app_ver Version of the application (eg. “1.0”) DeviceInfo
deviceid A unique device identifier. Note that this field has been removed and is no longer available. Not used
license_type Type of license (eg. “advanced_pro”) DeviceInfo
app_install_mode Tells if app is installed via app store (“store”), adhoc (“adhoc”), developer install (“dev_release”), simulator (“simulator”) or enterprise (“enterprise”) DeviceInfo
model Device model (eg. “MacBookPro11,3”) DeviceInfo
engine_ver Unity engine version (eg. “5.5.0a3”) DeviceInfo
os_ver OS Version (eg. “Mac OS X 10.11.5”) DeviceInfo
app_name Bundle identifier or package name (eg. “com.Company.ProductName”) DeviceInfo
timezone ISO code (eg. “GMT–7”) DeviceInfo
ads_tracking A boolean value that indicates whether the user has limited ad tracking DeviceInfo
adsid Advertising 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

  • 2018–06–28 Page amended

  • 2018–08–01 - Removed remote_ip field. It is no longer available.

  • 2018–06–28 - Removed UserInfo event.

  • 2018–06–04 - Removed deviceid and adsid from DeviceInfo event. Deprecated UserInfo event.

  • 2017–06–21 - Inclusion of empty nested fields in JSON exports changed in Unity 2017.1 NewIn20171

User Attributes (Atributos de Usuario)
Restablecimiento de datos