Skip to content

traintracks/javascript-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

javascript-sdk

Traintracks Javascript SDK

Usage

Javascript

  • 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

Options

  • token: String required your product key
  • secret: String required your product secret
  • build: String required your product version
  • userId: String required current user ID
  • userName: String required current user name
  • sessionId: String required session's ID
  • device: String optional device info, navigator.userAgent is used by default
  • latitude: Float optional gps latitude of event. both latitude and longitude must be sent to enable geospatial queries
  • longitude: Float optional gps longitude of event. both latitude and longitude must be sent to enable geospatial queries
  • endpoint: URL optional server endpoint, default is http://api.traintracks.io/v1/events
  • print: Boolean optional if print your event by console.log, false by default
  • dry: Boolean optional if bypass underlying requests, convenient for debugging, false by default

Example

For an example on how to use this SDK, please see javascript/test/live-example.html

About

Traintracks Javascript SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published