-
Notifications
You must be signed in to change notification settings - Fork 133
Defensive cleanup #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
0a88af0
refactor truncate
djih a18e9f8
migrate constants into constants.js
djih 5b85a40
clean up init config options
djih b8f31f4
validate config value types, update readme
djih 045c044
validate input type and add documentation for public functions
djih b9c890c
conflicting identify names
djih 8b636ff
capture initial utm parameters with setOnce
djih c91cac8
handle case 0 where not enough events or identifys
djih dc5d1c6
cleanup
djih d636512
jsdoc draft
djih 254fbf0
revert api changes
djih ee8ebde
Identify documentation
djih 0e7e535
reformat docs
djih 83d43df
add link to documentation in readme
djih e125160
refactor utm and referrer logic
djih 35caef9
append R to end of generated deviceId
djih 7c987e7
update docs on version
djih c4a0a0c
validate user properties
djih c3aedbd
cleaning up
djih b6d990f
log warning message for invalid option input type
djih b9dbacd
regenerate docs
djih 744ad1b
update docs
djih 772cec5
final cleanup
djih 138f38f
iterate over config keys instead of default keys, in most cases will …
djih 938952f
update identify docs
djih File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
Amplitude-Javascript | ||
==================== | ||
|
||
This Readme will guide you through using Amplitude's Javascript SDK to track users and events. You can also take a look at the [SDK documentation](https://rawgit.com/amplitude/Amplitude-Javascript/defensive_cleanup/documentation/Amplitude.html). | ||
|
||
# Setup # | ||
1. If you haven't already, go to http://amplitude.com and register for an account. You will receive an API Key. | ||
2. On every page that uses analytics, paste the following Javascript code between the `<head>` and `</head>` tags: | ||
|
@@ -224,18 +226,25 @@ amplitude.init('YOUR_API_KEY_HERE', null, { | |
}); | ||
``` | ||
|
||
| option | description | default | | ||
| option | type | description | default | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a type column |
||
|------------|----------------------------------------------------------------------------------|-----------| | ||
| saveEvents | If `true`, saves events to localStorage and removes them upon successful upload.<br><i>NOTE:</i> Without saving events, events may be lost if the user navigates to another page before events are uploaded. | `true` | | ||
| savedMaxCount | Maximum number of events to save in localStorage. If more events are logged while offline, old events are removed. | 1000 | | ||
| uploadBatchSize | Maximum number of events to send to the server per request. | 100 | | ||
| includeUtm | If `true`, finds utm parameters in the query string or the __utmz cookie, parses, and includes them as user propeties on all events uploaded. | `false` | | ||
| includeReferrer | If `true`, captures the `referrer` and `referring_domain` for each session, as well as the user's `initial_referrer` and `initial_referring_domain` via a set once operation. | `false` | | ||
| batchEvents | If `true`, events are batched together and uploaded only when the number of unsent events is greater than or equal to `eventUploadThreshold` or after `eventUploadPeriodMillis` milliseconds have passed since the first unsent event was logged. | `false` | | ||
| eventUploadThreshold | Minimum number of events to batch together per request if `batchEvents` is `true`. | 30 | | ||
| eventUploadPeriodMillis | Amount of time in milliseconds that the SDK waits before uploading events if `batchEvents` is `true`. | 30\*1000 (30 sec) | | ||
| deviceId | Custom device ID to set | Randomly generated UUID | | ||
| sessionTimeout | Time between logged events before a new session starts in milliseconds | 30\*60\*1000 (30 min) | | ||
| batchEvents | Boolean | If `true`, events are batched together and uploaded only when the number of unsent events is greater than or equal to `eventUploadThreshold` or after `eventUploadPeriodMillis` milliseconds have passed | `false` | | ||
| cookieExpiration | Number | The number of days after which the Amplitude cookie will expire | 365\*10 (10 years) | | ||
| cookieName | String | Custom name for the Amplitude cookie | `'amplitude_id'` | | ||
| deviceId | String | Custom device ID to set. Note this is not recommended unless you really know what you are doing (like if you have your own system for tracking user devices) | Randomly generated UUID | | ||
| domain | String | Custom cookie domain | The top domain of the current page's url | | ||
| eventUploadPeriodMillis | Number | Amount of time in milliseconds that the SDK waits before uploading events if `batchEvents` is `true` | 30\*1000 (30 sec) | | ||
| eventUploadThreshold | Number | Minimum number of events to batch together per request if `batchEvents` is `true` | 30 | | ||
| includeReferrer | Boolean | If `true`, captures the `referrer` and `referring_domain` for each session, as well as the user's `initial_referrer` and `initial_referring_domain` via a set once operation | `false` | | ||
| includeUtm | Boolean | If `true`, finds utm parameters in the query string or the __utmz cookie, parses, and includes them as user propeties on all events uploaded | `false` | | ||
| language | String | Custom language to set | Language determined by browser | | ||
| optOut | Boolean | Whether to opt the current user out of tracking | `false` | | ||
| platform | String | Custom platform to set | `'Web'` | | ||
| savedMaxCount | Number | Maximum number of events to save in localStorage. If more events are logged while offline, old events are removed. | 1000 | | ||
| saveEvents | Boolean | If `true`, saves events to localStorage and removes them upon successful upload.<br><i>NOTE:</i> Without saving events, events may be lost if the user navigates to another page before events are uploaded. | `true` | | ||
| sessionTimeout | Number | Time between logged events before a new session starts in milliseconds | 30\*60\*1000 (30 min) | | ||
| uploadBatchSize | Number | Maximum number of events to send to the server per request. | 100 | | ||
|
||
|
||
# Advanced # | ||
This SDK automatically grabs useful data about the browser, including browser type and operating system version. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered adding this to the default make command, but the html files are timestamped, so they would be modified with every make. Whenever someone updates the API, they need to remember to update the docs