OT4: How to use the API to download events per session

In this article we will show you how to get events per session with Opentracker API

Your main goal is to upload each event for a user to an backend/ database. You can pull the sessions information or visits but those reports won't display each event within those sessions. 

If this is important, for instance to backtrack which ads they've seen on the website, then this article explains more.

Opentracker's API for OT4 can be found here:
https://app.opentracker.net

Take a look at the API is documented on our swagger docs page.

Key things to note:
site=<customers site>
apiKey=<api key for that site>
startDate=yyyy-MM-dd HH:mm:ss format start date for the period
endDate=yyyy-MM-dd HH:mm:ss format end date for the period
timezone=timezone specified in terms of offset from UTC, if you want timezone to be CET, this field's value should be +01:00 
typeName=event (because we want only events)
termFilters=use_id:<actual_use_id_here>:event    <-- here just replace <actual_use_id> with the use_id for which we need the events
ascending=false (ascending = false will give the events in descending order, i.e. most recent event will be returned first
size=number of records to fetch, client can specify a value upto 10,000 here. 

The values filled in the screenshot are examples of how you can do this:

You can use the "Try it now!" button in the swagger page.