add did_hashed to segment identify

This commit is contained in:
Ansh Nanda
2023-10-24 17:23:22 -07:00
parent c6e28f88e5
commit d115bbac27
2 changed files with 8 additions and 4 deletions
+4 -2
View File
@@ -50,11 +50,13 @@ export function useAnalytics() {
export function init(store: RootStoreModel) { export function init(store: RootStoreModel) {
store.onSessionLoaded(() => { store.onSessionLoaded(() => {
const sess = store.session.currentSession const sess = store.session.currentSession
if (sess) { if (sess && sess.did) {
if (sess.email) { if (sess.email) {
store.log.debug('Ping w/hash')
const email_hashed = sha256(sess.email) const email_hashed = sha256(sess.email)
const did_hashed = sha256(sess.did)
segmentClient.identify(email_hashed, {email_hashed}) segmentClient.identify(email_hashed, {email_hashed})
segmentClient.identify(did_hashed, {did_hashed})
store.log.debug('Ping w/hash')
} else { } else {
store.log.debug('Ping w/o hash') store.log.debug('Ping w/o hash')
segmentClient.identify() segmentClient.identify()
+4 -2
View File
@@ -45,11 +45,13 @@ export function useAnalytics() {
export function init(store: RootStoreModel) { export function init(store: RootStoreModel) {
store.onSessionLoaded(() => { store.onSessionLoaded(() => {
const sess = store.session.currentSession const sess = store.session.currentSession
if (sess) { if (sess && sess.did) {
if (sess.email) { if (sess.email) {
store.log.debug('Ping w/hash')
const email_hashed = sha256(sess.email) const email_hashed = sha256(sess.email)
const did_hashed = sha256(sess.did)
segmentClient.identify(email_hashed, {email_hashed}) segmentClient.identify(email_hashed, {email_hashed})
segmentClient.identify(did_hashed, {did_hashed})
store.log.debug('Ping w/hash')
} else { } else {
store.log.debug('Ping w/o hash') store.log.debug('Ping w/o hash')
segmentClient.identify() segmentClient.identify()