Skip to content

Commit 65ca855

Browse files
committed
update changelog and readme
1 parent a2106d6 commit 65ca855

File tree

5 files changed

+28
-14
lines changed

5 files changed

+28
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Unreleased
22

3-
* Initial_referrer is captured as a setOnce, and referrer is only updated once per session; it is no longer sent with every event.
3+
* Add tracking of each user's initial_referrer property (which is captured as a set once operation). Referrer property captured once per user session.
44

55
## 2.6.2 (November 17, 2015)
66

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ If your app has its own login system that you want to track users with, you can
4444
amplitude.setUserId('USER_ID_HERE');
4545
```
4646

47-
A user's data will be merged on the backend so that any events up to that point from the same browser will be tracked under the same user.
47+
A user's data will be merged on the backend so that any events up to that point from the same browser will be tracked under the same user. Note: if a user logs out, or you want to log the events under an anonymous user, you may set the userId to `null` like so:
48+
49+
```javascript
50+
amplitude.setUserId(null); // not string 'null'
51+
```
4852

4953
You can also add the user ID as an argument to the `init` call:
5054

@@ -62,7 +66,7 @@ eventProperties.key = 'value';
6266
amplitude.logEvent('EVENT_IDENTIFIER_HERE', eventProperties);
6367
```
6468

65-
# User Property Operations #
69+
# User Properties and User Property Operations #
6670

6771
The SDK supports the operations `set`, `setOnce`, `unset`, and `add` on individual user properties. The operations are declared via a provided `Identify` interface. Multiple operations can be chained together in a single `Identify` object. The `Identify` object is then passed to the Amplitude client to send to the server. The results of the operations will be visible immediately in the dashboard, and take effect for events logged after.
6872

@@ -169,7 +173,7 @@ amplitude.init('YOUR_API_KEY_HERE', null, {
169173
| savedMaxCount | Maximum number of events to save in localStorage. If more events are logged while offline, old events are removed. | 1000 |
170174
| uploadBatchSize | Maximum number of events to send to the server per request. | 100 |
171175
| 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` |
172-
| includeReferrer | If `true`, includes `referrer` and `referring_domain` as user propeties on all events uploaded. | `false` |
176+
| 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` |
173177
| 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` |
174178
| eventUploadThreshold | Minimum number of events to batch together per request if `batchEvents` is `true`. | 30 |
175179
| eventUploadPeriodMillis | Amount of time in milliseconds that the SDK waits before uploading events if `batchEvents` is `true`. | 30\*1000 (30 sec) |

amplitude.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ var LocalStorageKeys = {
149149
LAST_SEQUENCE_NUMBER: 'amplitude_lastSequenceNumber',
150150
LAST_EVENT_TIME: 'amplitude_lastEventTime',
151151
SESSION_ID: 'amplitude_sessionId',
152+
REFERRER: 'amplitude_referrer',
152153

154+
// Used in cookie as well
153155
DEVICE_ID: 'amplitude_deviceId',
154156
USER_ID: 'amplitude_userId',
155-
OPT_OUT: 'amplitude_optOut',
156-
157-
REFERRER: 'amplitude_referrer'
157+
OPT_OUT: 'amplitude_optOut'
158158
};
159159

160160
/*
@@ -2441,15 +2441,25 @@ module.exports = function(val){
24412441
if (val !== val) return 'nan';
24422442
if (val && val.nodeType === 1) return 'element';
24432443

2444-
if (typeof Buffer != 'undefined' && Buffer.isBuffer(val)) return 'buffer';
2444+
if (isBuffer(val)) return 'buffer';
24452445

24462446
val = val.valueOf
24472447
? val.valueOf()
2448-
: Object.prototype.valueOf.apply(val)
2448+
: Object.prototype.valueOf.apply(val);
24492449

24502450
return typeof val;
24512451
};
24522452

2453+
// code borrowed from https://github.com/feross/is-buffer/blob/master/index.js
2454+
function isBuffer(obj) {
2455+
return !!(obj != null &&
2456+
(obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)
2457+
(obj.constructor &&
2458+
typeof obj.constructor.isBuffer === 'function' &&
2459+
obj.constructor.isBuffer(obj))
2460+
))
2461+
}
2462+
24532463
}, {}],
24542464
10: [function(require, module, exports) {
24552465
/* jshint eqeqeq: false, forin: false */

amplitude.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/amplitude.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ var LocalStorageKeys = {
4343
LAST_SEQUENCE_NUMBER: 'amplitude_lastSequenceNumber',
4444
LAST_EVENT_TIME: 'amplitude_lastEventTime',
4545
SESSION_ID: 'amplitude_sessionId',
46+
REFERRER: 'amplitude_referrer',
4647

48+
// Used in cookie as well
4749
DEVICE_ID: 'amplitude_deviceId',
4850
USER_ID: 'amplitude_userId',
49-
OPT_OUT: 'amplitude_optOut',
50-
51-
REFERRER: 'amplitude_referrer'
51+
OPT_OUT: 'amplitude_optOut'
5252
};
5353

5454
/*

0 commit comments

Comments
 (0)