Search Unity

Requesting raw analytics downloads of specific custom events tables

Discussion in 'Unity Analytics' started by sheldon_unity, Sep 20, 2019.

  1. sheldon_unity

    sheldon_unity

    Joined:
    Jul 27, 2018
    Posts:
    12
    Hi, I'm working with a custom analytics importer tool that automates taking our raw analytics data from unity analytics and inserting it into our database. I've noticed that some time ago, you provided the ability to do raw data exports of specific custom events tables. What I can't figure out is the specific syntax to request these tables in our python post request.

    If requesting data from one of the 'original' tables, like custom, appStart or deviceInfo, we just set up the post requests json string like so:
    postBodyJson = {'endDate': end_date, 'format': dump_format, 'dataset': data_set} ;

    where 'data_set' would equal 'custom', or 'appData', or 'deviceInfo'. What would the dataset value be for a specific custom event table (for example, if we have an event called 'level_start' and just want to download that data)? I've tried 'custom(level_start), but that doesn't seem to work.

    Thanks,

    Sheldon
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    There is only one custom event data set. level_start would be contained in that data set. You can filter by single event name by choosing "Name" under "Type" for the custom data set.
     

    Attached Files:

    • RDE.png
      RDE.png
      File size:
      65.9 KB
      Views:
      443
  3. sheldon_unity

    sheldon_unity

    Joined:
    Jul 27, 2018
    Posts:
    12
    Hey Jeff,

    the image you linked is for just using the UI from the analytics dashboard, whereas I'm trying to figure out how to send a post request for the same data via python. I can already do this for full data-sets (custom, appStart, deviceInfo, etc) using the method I described above, but I can't find documentation on how (or if it's possible to) request data from a specific custom event instead (to do the equivalent of what you just described, except without using the dashboard).

    postBodyJson = {'endDate': end_date, 'format': dump_format, 'dataset': data_set} ;

    headers = {'content-type': 'application/json'}
    r = requests.post(uri, json.dumps(postBodyJson), auth=HTTPBasicAuth(unity_project_id, unity_api_key),
    headers=headers)

    I assume that you are expecting an additional key/value pair in postBodyJson to indicate that a request for a specific table, and that's the part that I can't figure out. Would it be something like
    postBodyJson = {'endDate': end_date, 'format': dump_format, 'dataset': data_set, 'name': level_start} ?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  5. sheldon_unity

    sheldon_unity

    Joined:
    Jul 27, 2018
    Posts:
    12
    Thanks Jeff, that's exactly what I was looking for!