Skip to content
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

feat: add logAttributionCapturedEvent option #295

Merged
merged 7 commits into from
Sep 19, 2020
Merged

feat: add logAttributionCapturedEvent option #295

merged 7 commits into from
Sep 19, 2020

Conversation

kelsonpw
Copy link
Contributor

@kelsonpw kelsonpw commented Sep 11, 2020

Description

This is related to a recent Growth Eng effort to audit and optimize our UTM tracking and attribution. We would like a way to log an Amplitude event whenever attribution data is captured (utm, referrer, gclid). This is to compare our Amplitude SDK attribution with our alternative UTMz tracking setup on the corpsite & blog (already added a similar event here: https://github.com/amplitude/amplitude.com/pull/133).

Jira Ticket

Why we need this

We want to be able to get a full picture of every UTM/attribution state that a user has had during their Journey with Amplitude. Because Identify calls are not queryable, we are unable to devise a query that returns the information we are looking for. Also, because attribution consists of many properties (utm_source, utm_medium, utm_campaign, etc.), not all of them will have values.

Updated Context:

I met with @kelvin-lu last week to discuss this PR. He suggested that it might be possibly to query using pre-existing events such as pageview. I spent sometime investigating this approach and determined that it is not viable. Even though pageview events have the attribution state present in user properties, they do not signify that attribution actually changed (which is what we are looking for). Another idea I discussed with Kelvin was the ability to query identify events, but after speaking with Tanner, this approach has been explored and is impossible. The only way for us to accurately fire this event is VIA the sdk.

Copy link
Contributor

@jooohhn jooohhn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only 1 syntax suggestion. I think @haoliu-amp and @kelvin-lu have more to say application wise

gclidProperties = this._saveGclid(this._getUrlParams());
}
if (this.options.logAttributionCapturedEvent) {
const attributionProperties = Object.assign(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you could make this more concise/readable by using the ... spread operator instead of Object.assign

const attributionProperties = { ... utmProperties, ... referrerProperties, ...gclidProperties }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

@kelsonpw kelsonpw requested a review from jooohhn September 16, 2020 20:50
src/constants.js Outdated
UTM_CONTENT: 'utm_content'
UTM_CONTENT: 'utm_content',

ATTRIBUTION_EVENT: 'attribution captured'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open to feedback on a better event name

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe DEBUG: attribution captured or $attributionCaptured so it's clearer to our customers that this is autogenerated by the SDK and/or

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to $attributionCaptured

@haoliu-amp
Copy link
Contributor

haoliu-amp commented Sep 16, 2020

@kelsonpw The very first question. Is this something other users might want to use? Do we have any users requesting this? Usually we want to make auto tracking events to be generic.

@kelsonpw
Copy link
Contributor Author

@kelsonpw The very first question. Is this something other users might want to use? Do we have any users requesting this? Usually we want to make auto tracking events to be generic.

@haoliu-amp We do not currently have any users asking for this, but according to Tanner it is very likely that others would like to use this in the future. I did however talk to @kelvin-lu about an alternative solution that will allow us to access the captured UTM's and send our own event without forcing the SDK to send events. Will have a PR for that in 5-10 mins.

@kelsonpw
Copy link
Contributor Author

Closing in favor of PR #296

@kelsonpw kelsonpw closed this Sep 16, 2020
@kelsonpw kelsonpw reopened this Sep 17, 2020
@kelsonpw kelsonpw changed the title feature - wip - add logAttributionCapturedEvent option feature - add logAttributionCapturedEvent option Sep 17, 2020
@kelsonpw kelsonpw dismissed jooohhn’s stale review September 18, 2020 20:58

Change was made

@kelsonpw kelsonpw changed the title feature - add logAttributionCapturedEvent option feat: add logAttributionCapturedEvent option Sep 18, 2020
Copy link
Contributor

@jooohhn jooohhn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kelsonpw kelsonpw requested a review from sputh September 18, 2020 21:25
src/constants.js Outdated Show resolved Hide resolved
@kelsonpw kelsonpw requested a review from haoliu-amp September 18, 2020 23:03
@kelsonpw kelsonpw force-pushed the GROWTH-1094 branch 2 times, most recently from 37399e5 to a9c7dc0 Compare September 18, 2020 23:12
@kelsonpw kelsonpw force-pushed the GROWTH-1094 branch 2 times, most recently from 7097a06 to fa40657 Compare September 18, 2020 23:29
@kelsonpw kelsonpw merged commit 309dac3 into master Sep 19, 2020
@kelsonpw kelsonpw deleted the GROWTH-1094 branch September 19, 2020 00:53
github-actions bot pushed a commit that referenced this pull request Sep 22, 2020
# [7.2.0](v7.1.1...v7.2.0) (2020-09-21)

### Bug Fixes

* **cookies:** respect the options passed into cookies when testing to see if they're enabled ([#294](#294)) ([61b6590](61b6590))

### Features

* add logAttributionCapturedEvent option ([#295](#295)) ([309dac3](309dac3))
github-actions bot pushed a commit that referenced this pull request Sep 22, 2020
# [7.2.0](v7.1.1...v7.2.0) (2020-09-22)

### Bug Fixes

* **cookies:** respect the options passed into cookies when testing to see if they're enabled ([#294](#294)) ([61b6590](61b6590))

### Features

* add logAttributionCapturedEvent option ([#295](#295)) ([309dac3](309dac3))
github-actions bot pushed a commit that referenced this pull request Sep 22, 2020
# [7.2.0](v7.1.1...v7.2.0) (2020-09-22)

### Bug Fixes

* **cookies:** respect the options passed into cookies when testing to see if they're enabled ([#294](#294)) ([61b6590](61b6590))

### Features

* add logAttributionCapturedEvent option ([#295](#295)) ([309dac3](309dac3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants