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

Creates UUID, puts into local and sends event to posthog #113

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

zuuring
Copy link
Contributor

@zuuring zuuring commented Oct 17, 2022

How to use

Import the Posthog event
import { posthogEvent } from "shared/analytics/posthog";

Call the function where you need events to fire
posthogEvent("Insert your posthog event title here")

Notes

  • This adds the basic functionality to generate a new UUID the first time the user visits the /download/ page which is then put both as a cookie + localStorage key entry UUID.

  • Sends Download page visited event to posthog

  • Checks if UUID already present and if not, creates UUID and puts in storage

Testing

  • Visit (https://deploy-preview-113--tally-cash.netlify.app/download/) to generate a UUID
  • Check via developer tools Application > Storage > Cookies > if UUID is present
  • Confirm event saved in Posthog https://app.posthog.com/events

- This adds the basic functionality to generate a new UUID the first time the user visits the /download/ page which is then put both as a `cookie + localStorage` key entry `UUID`.

- Sends `Download page visited` event to posthog
- Checks if UUID already present and if not, creates UUID and puts in storage
- Added cookie expiry date to see if it resolves issue causing cookie to not be read across website -> extension
@zuuring zuuring marked this pull request as ready for review October 19, 2022 07:42
GATSBY_DISCORD_APP_ID="1008427467918295044"
Copy link
Contributor

Choose a reason for hiding this comment

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

This env variable does not seem to be in use

@@ -56,7 +56,8 @@
"react-helmet": "^6.1.0",
"react-query": "^3.39.1",
"siwe": "^1.1.6",
"ulid": "^2.3.0"
"ulid": "^2.3.0",
"uuid": "^9.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

We might consider using the ulid library here instead of importing a new uuid library. Not a blocker.

Accept: "application/json",
},
})
// eslint-disable-next-line no-console
Copy link
Contributor

Choose a reason for hiding this comment

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

rm

},
})
// eslint-disable-next-line no-console
console.log("UUID:", retrievedUUID)
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't need a console.log here

@mhluongo
Copy link
Contributor

@zuuring any chance we can do this all localStorage and skip the cookie? What's the downside?

@greg-nagy greg-nagy marked this pull request as draft October 19, 2022 18:22
@greg-nagy
Copy link
Contributor

We need further project clarifications before this will deploy ready.

@zuuring
Copy link
Contributor Author

zuuring commented Oct 20, 2022

@zuuring any chance we can do this all localStorage and skip the cookie? What's the downside?

@mhluongo We looked into this and using localStorage on the extension side will require us to enable storage permissions which will flag a permission modal when installing the extension.

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