HomeGuidesRecipesAPI
HomeGuidesAPILog In

Device (Location) Log

The device and location as its name suggests, stores the technologies used to access SmartIQ together with any location data that can be obtained during a user's session.

🚧

Analytics Module

Only available in environments with an analytics module license.

🚧

Web Only

Device and Location Log data is captured via the Produce App only

Location data is categorized into high and low accuracy readings. SmartIQ always adds a low accuracy record by default and then attempts a second high accuracy reading where the SmartIQ application is hosted on a secure server and the user has agreed to do so, usually by answering yes to a security question like the one below.

461461

Regardless of the low or high accuracy reading SmartIQ can attempt to convert the IP address into a more reportable regional field such as Country, City, Region, etc. SmartIQ must request regional information from an external service. By default, SmartIQ makes requests to https://ipapi.co over a secure SSL connection.

Free services generally have a small daily limit (eg: 1000 requests) if you wish to use the location log for a large number of calls you will need to sign up to one the services for a paid account.

It is possible for server administrators to disable or set a different location service URL by adding LocationApiURL setting in Produce's appsettings.json file. The following location services are supported and examples are provided below.

Service

AppSetting Value

Notes

https://ipapi.co

https://ipapi.co//json

Is available over SSL.

https://ipinfo.io

https://ipapi.io//json

Is available over SSL.

https://api.ipinfoab.com

http://api.ipinfoab.com/v3/ip-city/?key={{keyGoesHere}}&ip=&format=json

Requires the registration to get a key. Is available over SSL.

https://ipstack.com

http://api.ipstack.com/?access_key={{keyGoesHere}}&output=json

Requires the registration to get a key. Is available over SSL for paid accounts.

http://ip-api.com

http://ip-api.com/json/

"AppSettings": {
    "LocationApiURL": "http://ipapi.io/<ipaddress>/json",
    "Theme": "Cerulean"
  },
  "ConnectionStrings": {
    "DefaultConnection": "Password=infiniti;Persist Security Info=True;User ID=infiniti;Initial Catalog=InfinitiDev;Data Source=server1234"
  },
  ...

🚧

External Location Requests

Where it is not appropriate to make a call to the a location service the feature can be disabled from Manage by choosing the Settings option, going to the Retention tab and deselecting the Store Location Data option.

The device log captures the specific fields below

Field

Notes

Browser

User's Browser e.g.: Chrome, Edge, Android, Chrome Mobile, IE, Firefox etc

BrowserVersionMajor and BrowserVersionMinor

Browser Version eg: for Edge 15.15063 the major version is 15 and 15063 is the minor.

Country and Country Code

Retrieved Country Full name and two digit code

Device

Users Device eg: Apple, Samsung etc.

IPAddress

The external facing IP address of the client device that the user is logged in at.

Languages

List of languages available in the user's current browser

Longitude and Latitude

User's Longitude and Latitude

LocationAccuracy

Low accuracy reflects a location sourced only from an IP address. High accuracy uses device GPS if available or other network location information. A user must agree on their device for high accuracy information to be recorded.

LoginTimeUtc

The time the current login session was created in Coordinated Universal Time (UTC).

MetroCode

The code for the local metro area the user is located in, if available (usually only for USA)

Model

The model of the device the user is logged in at e.g: iPad

OS

OS The operating system for the device

OSVersionMajor and OSVersionMinor

The version of the OS of the user's device e.g. for Android 7.1 major is 7 and minor is 1.

Platform

The platform of the device the user is logged in to e.g. WinNT

PostalCode

Postal/zip code of the location of the user

Region and RegionCode

The region, state, county or province the user is located.

TimeZone

The timezone the user is located in if available

UserGuid

User identifier

Username

Users login username

📘

Raw Device Log Data

To access the raw device log data the following query can be run against the SmartIQ Database.

SELECT TOP (1000) [IPAddress]
,[OS]
,[OSVersionMajor]
,[OSVersionMinor]
,[City]
,[Country]
,[CountryCode]
,[Region]
,[RegionCode]
,[PostalCode]
,[TimeZone]
,[Browser]
,[BrowserVersionMajor]
,[BrowserVersionMinor]
,[Device]
,[Model]
,[Platform]
,[Latitude]
,[Longitude]
,[Languages]
,[UserGuid]
,[LoginTimeUtc]
,[LocationAccuracy]
FROM [Analytics_DeviceLog]