You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Contributing to the Amplitude SDK for JavaScript
2
+
🎉 Thanks for your interest in contributing! 🎉
3
+
4
+
## Ramping Up
5
+
### Intro
6
+
- There are three ways for SDK to be loaded
7
+
- Standard NPM package
8
+
- Snippet in `<script>` tag
9
+
- RequireJS (may be dropped in future)
10
+
- Workflow is facilitated with both `make` and `yarn` (legacy, may possibly be updated to full `yarn`)
11
+
- Chek out the [Amplitude Instrumentation Explorer]((https://chrome.google.com/webstore/detail/amplitude-instrumentation/acehfjhnmhbmgkedjmjlobpgdicnhkbp)) to help logging events during development
12
+
13
+
### Architecture
14
+
-`index.js` is the main entrypoint of SDK
15
+
- Stubbed methods are used when client imports via `<script>` snippet
16
+
- Allows app to not be blocked while real JS SDK is loaded in
17
+
- Sent events and identifys are tracked with queues
18
+
- Metadata storage (new) vs cookie (old) storage
19
+
- more of issue with anonymous id, because it uses device id instead of user id
20
+
- UA Parser: Helps identify browsers
21
+
- might be able to use upstream library and convert results, rather than our fork
22
+
- sameSiteCookie: Sets how public the cookie reading is
23
+
- `amplitude.getInstance() is necessary even during reuse because of snippet stubbed
Copy file name to clipboardExpand all lines: README.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,22 +13,27 @@
13
13
A JavaScript SDK for tracking events and revenue to [Amplitude](https://www.amplitude.com).
14
14
15
15
## Installation and Quick Start
16
-
Please visit our :100:[Developer Center](https://developers.amplitude.com/docs/javascript) for instructions on installing and using our the SDK.
16
+
* For using the SDK, please visit our :100:[Developer Center](https://developers.amplitude.com/docs/javascript) for instructions on installing and using our the SDK.
17
+
* For developing the SDK, please visit our [CONTRIBUTING.md](https://github.com/amplitude/Amplitude-JavaScript/blob/master/CONTRIBUTING.md) to get started.
17
18
18
19
## Demo Pages
19
20
* A [demo page](https://github.com/amplitude/Amplitude-JavaScript/blob/master/test/browser/amplitudejs.html) showing a simple integration on a web page.
20
21
* A [demo page](https://github.com/amplitude/Amplitude-JavaScript/blob/master/test/browser/amplitudejs-requirejs.html) showing an integration using RequireJS.
21
22
* A [demo page](https://github.com/amplitude/GTM-Web-Demo) demonstrating a potential integration with Google Tag Manager.
22
23
23
-
## Changelog
24
-
Click [here](https://github.com/amplitude/Amplitude-JavaScript/blob/master/CHANGELOG.md) to view the JavaScript SDK Changelog.
25
24
26
25
## React Native
27
26
This library now supports react-native. It has two dependencies on react-native modules you will have to install yourself:
28
27
29
28
*[react-native-device-info](https://www.npmjs.com/package/react-native-device-info) Tested with version 3.1.4
30
29
*[@react-native-community/async-storage](https://www.npmjs.com/package/@react-native-community/async-storage) Tested with version 1.6.2
31
30
31
+
## Node.js
32
+
Please visit [Amplitude-Node](https://github.com/amplitude/Amplitude-Node) for our Node SDK.
33
+
34
+
## Changelog
35
+
Click [here](https://github.com/amplitude/Amplitude-JavaScript/blob/master/CHANGELOG.md) to view the JavaScript SDK Changelog.
36
+
32
37
## Upgrading Major Versions and Breaking Changes #
Copy file name to clipboardExpand all lines: src/amplitude.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ import { version } from '../package.json';
8
8
importDEFAULT_OPTIONSfrom'./options';
9
9
10
10
/**
11
-
* Amplitude SDK API - instance manager.
11
+
* Legacy API of Amplitude SDK - instance manager. Wraps around the current amplitude-client.js which provides more features
12
12
* Function calls directly on amplitude have been deprecated. Please call methods on the default shared instance: amplitude.getInstance() instead.
13
13
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#300-update-and-logging-events-to-multiple-amplitude-apps} for more information about this change.
Base64.encode(userId||''),// used to convert not unicode to alphanumeric since cookies only use alphanumeric
43
52
optOut ? '1' : '',
44
-
sessionId ? sessionId.toString(32) : '0',
45
-
lastEventTime ? lastEventTime.toString(32) : '0',
53
+
sessionId ? sessionId.toString(32) : '0',// generated when instantiated, timestamp (but re-uses session id in cookie if not expired) @TODO clients may want custom session id
54
+
lastEventTime ? lastEventTime.toString(32) : '0',// last time an event was set
0 commit comments