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

fix: marketing link tracking #9445

Merged
merged 5 commits into from
Oct 20, 2023
Merged

fix: marketing link tracking #9445

merged 5 commits into from
Oct 20, 2023

Conversation

gkartalis
Copy link
Member

@gkartalis gkartalis commented Oct 18, 2023

This PR resolves PHIRE-343

Description

Fixes marketing link tracking - tested on iOS ✅
Fixes double tracking on normal deep links for logged out users - tested on iOS ✅

More info on decisions can be found here
and for the bonus bug fix ar

Warning

Would like for at least 1 person to test with any click.artsy.net link from an email with an android device if possible since yarn open-url doesn't work with android

Before After
logged in
RPReplay_Final1697631595.MP4
Screen.Recording.2023-10-19.at.17.22.18.mov
logged out
RPReplay_Final1697631693.MP4
Screen.Recording.2023-10-19.at.17.54.39.mov

Note

Also fixes a double tracking bug that we had for logged out users - removed tracking from inside useEffect (see more context on this slack thread

PR Checklist

  • I have tested my changes on iOS and Android.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

iOS user-facing changes

Android user-facing changes

Dev changes

  • marketing link tracking - gkartalis

Need help with something? Have a look at our docs, or get in touch with us.

@gkartalis gkartalis self-assigned this Oct 18, 2023
Comment on lines 33 to 34
// track deep link tap
trackEvent(tracks.deepLink(url))
Copy link
Member Author

@gkartalis gkartalis Oct 18, 2023

Choose a reason for hiding this comment

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

right now if a user is logged out we track the deeplink tap even if they land on the login page and never actually get navigated to the sceen. Do we want to change that to track right before navigating to the page ?

@ArtsyOpenSource
Copy link
Contributor

ArtsyOpenSource commented Oct 18, 2023

This PR contains the following changes:

  • Dev changes (marketing link tracking - gkartalis)

Generated by 🚫 dangerJS against 669e89d

@gkartalis gkartalis marked this pull request as ready for review October 18, 2023 12:28
@gkartalis
Copy link
Member Author

asked here for the deeplink payload https://artsy.slack.com/archives/C03NF9TKR/p1697645671461019

@gkartalis
Copy link
Member Author

Testing + Adding new videos for the refactored behavior

Comment on lines +71 to +85
let response
try {
response = await fetch(targetURL)
} catch (error) {
if (__DEV__) {
console.warn(error)
} else {
captureMessage(
`[navigate] Error fetching marketing url redirect on: ${targetURL} failed with error: ${error}`,
"error"
)
}
}

if (response?.url) {
Copy link
Member Author

Choose a reason for hiding this comment

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

unrelated - just adding a catch to this fetch

Comment on lines -51 to -55
// These will be redirected, avoided double tracking
if (!launchURL.current.includes("click.artsy.net")) {
trackEvent(tracks.deepLink(launchURL.current))
}

Copy link
Member Author

Choose a reason for hiding this comment

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

this was causing double tracking for logged out users (for non-marketing links)

Copy link
Contributor

@brainbicycle brainbicycle left a comment

Choose a reason for hiding this comment

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

nice 🥇

Copy link
Member

@MounirDhahri MounirDhahri left a comment

Choose a reason for hiding this comment

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

Niice

@gkartalis gkartalis merged commit 3026db6 into main Oct 20, 2023
@gkartalis gkartalis deleted the gkartalis/deeplink-tracking branch October 20, 2023 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants