Created
August 31, 2015 17:43
-
-
Save boomtrain-support/f5abb313a0fe87df4076 to your computer and use it in GitHub Desktop.
POST /event/track - An example request for this endpoint using jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| function eventTrack() { | |
| // JSON stringify the data | |
| var json_data = JSON.stringify({ | |
| 'type': '{Event Type}', | |
| 'model': '{Model Type}', | |
| 'id': '{Resource ID}', | |
| 'userId': '{User ID}', | |
| 'timestamp': '{ISO Formatted Timestamp, will be generated if not specified}' | |
| }); | |
| // Send a jQuery AJAX request to track the new event | |
| $.ajax({ | |
| url: 'https://events.boomtrain.com/event/track', | |
| // Replace your Username, Password, and App Id | |
| headers: { | |
| 'x-app-id': '{Your App Id}', | |
| 'Content-Type': 'application/json', | |
| 'Authorization': 'Basic ' + btoa('{Your Username}:{Your Password}') | |
| }, | |
| type: 'POST', | |
| data: json_data, | |
| success: function(msg) { | |
| console.log(msg) | |
| } | |
| }); | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment