Skip to content

Commit e40e9e8

Browse files
committed
update readme and test cases
1 parent 60817ed commit e40e9e8

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Amplitude-Javascript
3636

3737
# 3.0.0 Update and Logging Events to Multiple Amplitude Apps #
3838

39-
Version 3.0.0 is a major update that brings support for logging events to multiple Amplitude apps (multiple API keys). **Note: this change may break backwards compatibility on your setup.** See the subsection below on backwards compatibility.
39+
Version 3.0.0 is a major update that brings support for logging events to multiple Amplitude apps (multiple API keys). **Note: this change is not 100% backwards compatible and may break on your setup.** See the subsection below on backwards compatibility.
4040

4141
### API Changes ###
4242

@@ -292,7 +292,6 @@ amplitude.getInstance().init('YOUR_API_KEY_HERE', null, {
292292
| eventUploadPeriodMillis | Amount of time in milliseconds that the SDK waits before uploading events if `batchEvents` is `true`. | 30\*1000 (30 sec) |
293293
| deviceId | Custom device ID to set | Randomly generated UUID |
294294
| sessionTimeout | Time between logged events before a new session starts in milliseconds | 30\*60\*1000 (30 min) |
295-
| newBlankInstance | initialize this instance with a newly generated deviceId (does not inherit existing deviceId and userId values from before [v3.0.0 update](https://github.com/amplitude/Amplitude-Javascrip#logging-events-to-multiple-amplitude-apps)) | `false` |
296295

297296
# Advanced #
298297
This SDK automatically grabs useful data about the browser, including browser type and operating system version.

test/browser/amplitudejs.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,27 @@
7474
};
7575
</script>
7676
<script>
77-
amplitude.getInstance('app1').init('a2dbce0e18dfe5f8e74493843ff5c053', null, {includeReferrer: true}, function() {
78-
alert(amplitude.getInstance('app1').options.deviceId);
77+
amplitude.init('a2dbce0e18dfe5f8e74493843ff5c053', null, {includeReferrer: true}, function() {
78+
alert(amplitude.options.deviceId);
7979
});
80-
amplitude.getInstance('app1').setVersionName('Web');
81-
amplitude.getInstance('app1').identify(new amplitude.Identify().add('photoCount', 1));
82-
amplitude.getInstance('app1').identify(new amplitude.Identify().add('photoCount', 1).set('gender', 'male').unset('karma'));
83-
amplitude.getInstance('app1').logEvent('pageLoad');
80+
amplitude.setVersionName('Web');
81+
amplitude.identify(new amplitude.Identify().add('photoCount', 1));
82+
amplitude.identify(new amplitude.Identify().add('photoCount', 1).set('gender', 'male').unset('karma'));
83+
amplitude.logEvent('pageLoad');
8484

8585
amplitude.getInstance('app2').logEvent('log event before init');
86-
amplitude.getInstance('app2').init('5a7d9276272cd8d8af9992e41dbdeb95', 'checkers@gmail.com', {includeReferrer: true}, function() {
86+
amplitude.getInstance('app2').init('1d2fe1e104eb3f07a24e94d359f70fd5', 'checkers@gmail.com', {includeReferrer: true}, function() {
8787
alert(amplitude.getInstance('app2').options.deviceId);
8888
});
8989
amplitude.getInstance('app2').identify(new amplitude.Identify().set('key', 'value'));
9090
amplitude.getInstance('app2').logEvent('app 2 page load');
91+
92+
amplitude.getInstance('app3').init('a2dbce0e18dfe5f8e74493843ff5c053', null, {batchEvents: true, eventUploadThreshold: 2});
93+
amplitude.getInstance('app3').logEvent('app3 pageLoad');
94+
95+
amplitude.getInstance('app4').init('1d2fe1e104eb3f07a24e94d359f70fd5', 'joe@gmail.com');
96+
amplitude.getInstance('app4').logEvent('app 4 page load');
97+
9198
</script>
9299
<body>
93100
<h3>Amplitude JS Test</h3>

0 commit comments

Comments
 (0)