Skip to content

Commit

Permalink
Add option to use amplitude referral behaviour (#639)
Browse files Browse the repository at this point in the history
* Add option to use amplitude referral

* bump version
  • Loading branch information
danieljackins authored Oct 26, 2021
1 parent b0a9169 commit 0c0f9eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion integrations/amplitude/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ var Amplitude = (module.exports = integration('Amplitude')
.option('unsetParamsReferrerOnNewSession', false)
.option('trackProductsOnce', false)
.option('versionName', '')
.option('useAmplitudeReferral', false)
.tag('<script src="' + src + '">'));

/**
Expand Down Expand Up @@ -81,6 +82,7 @@ Amplitude.prototype.initialize = function() {
includeGclid: this.options.trackGclid,
saveParamsReferrerOncePerSession: this.options
.saveParamsReferrerOncePerSession,
includeReferrer: this.options.useAmplitudeReferral,
deviceIdFromUrlParam: this.options.deviceIdFromUrlParam,
unsetParamsReferrerOnNewSession: this.options
.unsetParamsReferrerOnNewSession,
Expand Down Expand Up @@ -144,7 +146,8 @@ Amplitude.prototype.loaded = function() {
Amplitude.prototype.page = function(page) {
this.setDeviceIdFromAnonymousId(page);

if (this.options.trackReferrer) this.sendReferrer();
if (this.options.trackReferrer && !this.options.useAmplitudeReferral)
this.sendReferrer();

var category = page.category();
var name = page.fullName();
Expand Down
2 changes: 1 addition & 1 deletion integrations/amplitude/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@segment/analytics.js-integration-amplitude",
"description": "The Amplitude analytics.js integration.",
"version": "3.3.2",
"version": "3.3.3",
"keywords": [
"analytics.js",
"analytics.js-integration",
Expand Down

0 comments on commit 0c0f9eb

Please sign in to comment.