Skip to content

Conversation

gtupak
Copy link
Collaborator

@gtupak gtupak commented Nov 17, 2022

At the initial page visit, add the source, medium and campaign as parameters to the REFERRER event call if their respective UTM tags are present in the url (utm_source, utm_medium and utm_campaign, respectively).

@stuart-watt, I renamed campaignId to campaign fyi, to match the utm tag namings, in case you need to change anything on your end.

@gtupak gtupak requested review from xitronix and kquintal November 17, 2022 17:56
@gtupak gtupak force-pushed the test/add-provider-tests branch from 072fd88 to e544df8 Compare November 17, 2022 19:19
@gtupak gtupak force-pushed the feat/auto-track-utm branch 3 times, most recently from e82953a to e8f1689 Compare November 17, 2022 19:57
@gtupak gtupak linked an issue Nov 17, 2022 that may be closed by this pull request
Copy link
Contributor

@xitronix xitronix left a comment

Choose a reason for hiding this comment

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

Referrer and utm tags are different things, Kale named utm tags as attribute. So we should separate this functionality in my opinion or remove attribute function. Let's discuss it during stand up

Copy link
Contributor

@kquintal kquintal left a comment

Choose a reason for hiding this comment

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

Seems good, the granularity of tests also gives me confidence.

From @xitronix comment tho, seems you two want to change this, so I'll just comment and feel free to re-request review after your discussion.

Base automatically changed from test/add-provider-tests to main November 18, 2022 16:13
@gtupak gtupak force-pushed the feat/auto-track-utm branch from e8f1689 to e238b08 Compare November 18, 2022 16:17
@gtupak
Copy link
Collaborator Author

gtupak commented Nov 18, 2022

@xitronix I agree with your comment. What would you say if we:

  1. Replace the REFERRER event by FIRST_PAGE_VISIT, which includes url and referrer, source, medium, campaign if present
  2. Add a config option to automatically report UTM tags which is true by default. If false, we won't add the 3 utm parameters in the call above
  3. Throw in attribute() if the config option of (2.) is true
  4. Throw in referrer() if the config option of auto-reporting referrer is true

@xitronix
Copy link
Contributor

I agree, the only thing which i want to specfy is that attributes should look like :

{
   referrer: ...,
   utm: {
      source: ...,
      ....
   }
}

@gtupak
Copy link
Collaborator Author

gtupak commented Nov 22, 2022

  • We should also probably save to the sessionStorage that the FIRST_PAGE_VISIT call was already made
  • Throw an error in attribution() and referrer() functions if their respective automatic report config is set to true

@gtupak gtupak force-pushed the feat/auto-track-utm branch from e238b08 to 9b65fed Compare November 22, 2022 19:02
@gtupak gtupak requested a review from xitronix November 22, 2022 19:02
Comment on lines 41 to 47
url?: string
referrer?: string
utm?: {
source?: string
medium?: string
campaign?: string
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@stuart-watt this would be the attribute structure of the FIRST_PAGE_VISIT event. Would you like to change anything?

Choose a reason for hiding this comment

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

This is perfect for me, no changes required @gtupak

Copy link

@stuart-watt stuart-watt Nov 23, 2022

Choose a reason for hiding this comment

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

It would actually be simpler on my end if the url, referrer, source, medium and campaign were all on the same level. i.e. no need for the utm key. Since I know what source, medium and campaign are UTM tags, I don't see a need to explicitly have a nested utm dictionary.

Although I can work with the structure above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I find it better structured this way. In case we want to add more information to this call in the future, we can add other nested objects inside based on their category. If we put all of them at the same level it might create confusion in the future and increase tech debt potential.

@gtupak gtupak force-pushed the feat/auto-track-utm branch from 79a1e2c to ebccb95 Compare November 22, 2022 21:58
@gtupak gtupak requested a review from xitronix November 22, 2022 22:24
add window object typing

rm comments and log

do not save the url on the window object and add medium option to attribute call

make the current url private

add arcx analyticx provider and CRA example project

log page events

track event clicks on console view

update readme

fix installations

add missing peer dependencies

ignore webpack config ts to avoid eslint errors

update header and favicon

support react versions >=16

improve example repo

move the helper outside the analytics sdk class

add window object typing

rm comments and log

do not save the url on the window object and add medium option to attribute call

make the current url private

add arcx analyticx provider and CRA example project

log page events

track event clicks on console view

update readme

fix installations

add missing peer dependencies

ignore webpack config ts to avoid eslint errors

add react testing library

add first provider test

add remaining provider tests

add coverage report

100% coverage on provider

test attribution event

rm log

simplify button clicks

log test (debugging)

rm log

add missing peer dep

adjust comments

move the helper outside the analytics sdk class

add window object typing

rm comments and log

do not save the url on the window object and add medium option to attribute call

make the current url private

add arcx analyticx provider and CRA example project

log page events

track event clicks on console view

update readme

fix installations

add missing peer dependencies

ignore webpack config ts to avoid eslint errors

update header and favicon

support react versions >=16

improve example repo

move the helper outside the analytics sdk class

add window object typing

rm comments and log

do not save the url on the window object and add medium option to attribute call

make the current url private

add arcx analyticx provider and CRA example project

log page events

track event clicks on console view

update readme

fix installations

add missing peer dependencies

ignore webpack config ts to avoid eslint errors

add react testing library

add first provider test

add remaining provider tests

add coverage report

100% coverage on provider

test attribution event

rm log

simplify button clicks

log test (debugging)

rm log

auto-track utm tags as part of the REFERRER call, rename campaignId to campaign
@gtupak gtupak force-pushed the feat/auto-track-utm branch from f9a6f60 to 52a21fe Compare November 23, 2022 18:50
@gtupak gtupak merged commit 22463b8 into main Nov 23, 2022
@gtupak gtupak deleted the feat/auto-track-utm branch November 23, 2022 21:30
@gtupak
Copy link
Collaborator Author

gtupak commented Nov 24, 2022

🎉 This PR is included in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Auto-track UTM tags
4 participants