Skip to content
This repository has been archived by the owner on May 15, 2020. It is now read-only.

Update Analytics.js #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jodybrewster
Copy link
Contributor

Added ability to set user ID

Added ability to set user ID
@@ -36,6 +43,9 @@ export default class Analytics {
}
}

return fetch(`https://www.google-analytics.com/collect?${hit.toQueryString()}&${this.customDimensions.toQueryString()}&z=${Math.round(Math.random() * 1e8)}`, options);
if (this.userId !== null && this.userId !== undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like this could just be a falsy check, no? if (this.userId) { ? -- Also I'd probably prefer just uid as the variable name.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants