Skip to content

Commit

Permalink
πŸ“ˆ Set wallet in crisp (#1804)
Browse files Browse the repository at this point in the history
* πŸ“ˆ Set wallet in crisp

* πŸ“ˆ Set segment in crisp

* πŸ› Stringify items array in crisp event
  • Loading branch information
williamchong authored Sep 13, 2024
1 parent e6acd56 commit c09ba50
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/util/EventLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export async function setLoggerUser(
vue.$gtag.event('login', { method });
}
}
if (vue.$crisp) {
vue.$crisp.push(['set', 'session:data', ['wallet', wallet]]);
vue.$crisp.push(['set', 'session:data', ['loginMethod', method]]);
}
} catch (err) {
console.error(err); // eslint-disable-line no-console
}
Expand All @@ -72,6 +76,7 @@ export function updateLoggerUserInfo(vue, { wallet, displayName, email }) {
vue.$sentry.setUser(opt);
}
if (vue.$crisp) {
vue.$crisp.push(['set', 'session:data', ['wallet', wallet]]);
if (displayName) {
vue.$crisp.push(['set', 'user:nickname', [displayName || wallet]]);
}
Expand Down Expand Up @@ -101,6 +106,9 @@ export function logTrackerEvent(
});
}
if (vue.$crisp) {
if (action === 'nft_free_nft_book_purchased') {
vue.$crisp.push(['set', 'session:segments', [['free book']]]);
}
vue.$crisp.push([
'set',
'session:event',
Expand Down Expand Up @@ -178,14 +186,17 @@ export function logPurchaseFlowEvent(
{
price,
currency,
items: items.map(
i => i.productId || i.collectionId || i.classId
items: JSON.stringify(
items.map(i => i.productId || i.collectionId || i.classId)
),
},
],
],
],
]);
if (event === 'purchase') {
vue.$crisp.push(['set', 'session:segments', [['purchaser']]]);
}
}
} catch (err) {
console.error('logging error:'); // eslint-disable-line no-console
Expand Down

0 comments on commit c09ba50

Please sign in to comment.