Skip to content

NearIT SDKs collects many events related to user position using geofencing and bluetooth beacons.

Presence Analytics

NearIT provide an API to read organized presence analytics for your app.
To query this API you will need your NearIT app ID and the ID of the geofence node you want to analize.

GET https://api.nearit.com/stats/[app_id]/geo/[node_id]
Parameter Description
from starting date (yyyy/mm/dd)
to end date (yyyy/mm/dd) (included)

Response

The API will provide a report of the presences for the geofence inside the "attributes" object:

Parameter Description
total Number unique users detected inside the geofence
hits Number of unique users detected inside any of the included beacon areas
sub_hits Number of unique users ranged for any of the included beacon
lost Unique users detected inside the geofence but not detected by beacons

The "included" object will contain specific information about any contained beacon area:

Parameter Description
total Number unique users detected inside the beacon area
hits Number of unique users ranged by any of the included beacon
lost Unique users detected inside the beacon area but not ranged
{
   "data":{
      "type":"stats",
      "id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "attributes":{
         "total":14,
         "hits":10,
         "sub_hits":7,
         "lost":7,
         "identifier":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
      },
      "relationships":{
         "areas":{
            "data":[
               {
                  "type":"stats",
                  "id":"YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY"
               }
            ]
         }
      }
   },
   "included":[
      {
         "type":"stats",
         "id":"YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY",
         "attributes":{
            "total":10,
            "hits":7,
            "sub_hits":0,
            "lost":3,
            "identifier":"YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY"
         }
      }
   ]
}

Raw Data

In case you need a different representation of the data you can read directly the tracking event log.
You can use this feature to create reports, we recommend to not include the current date in the call to avoid managing incomplete data (cut-off is at 12AM UTC).

GET https://api.nearit.com/plugins/geopolis/trackings
Parameter Description
filter[app_id] NearIT app ID
filter[from] starting date (yyyy/mm/dd) (optional)
filter[to] end date (yyyy/mm/dd) (included)
page[size] results per page (maximum is 1000)
page[number] requested page

The call will return a paginated list of logged trackings:

"data" : [
    {
        "id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
        "type" : "trackings",
        "attributes" : {
            "identifier" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
            "event" : "enter_place",
            "tracked_at" : "2017-01-11T16:58:41.159Z",
            "installation_id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
            "profile_id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
            "app_id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
            "metadata" : {},
            "created_at" : "2017-01-11T16:58:41.317Z"
        }
    }, 
    ...
],
"meta" : {
    "total_count" : 1103
}

Every log contains this main fields:

  • identifier : The geofence, beacon or tag that caused the event
  • event: The type of event occurred
  • tracked_at: The timestamp of the event
  • installation_id: The NearIT ID for the device
  • profile_id: The NearIT ID for the user

Complete Reference

For more details about our location system please look at the NearIT Geopolis APIs reference.