Traintracks Javascript SDK
- Include javascript/production/sdk[-min].js
- Run
TT.init(options: Object)to intialize SDK - Run
TT.log(eventType: String, data: Object)to send your event to Traintracks
token: Stringrequired your product keysecret: Stringrequired your product secretbuild: Stringrequired your product versionuserId: Stringrequired current user IDuserName: Stringrequired current user namesessionId: Stringrequired session's IDdevice: Stringoptional device info, navigator.userAgent is used by defaultlatitude: Floatoptional gps latitude of event. both latitude and longitude must be sent to enable geospatial querieslongitude: Floatoptional gps longitude of event. both latitude and longitude must be sent to enable geospatial queriesendpoint: URLoptional server endpoint, default is http://api.traintracks.io/v1/eventsprint: Booleanoptional if print your event by console.log, false by defaultdry: Booleanoptional if bypass underlying requests, convenient for debugging, false by default
For an example on how to use this SDK, please see javascript/test/live-example.html