Skip to content

Commit

Permalink
chore: fix analytics visit tracking with no GA id (#2445)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulBit authored Oct 21, 2022
1 parent f846840 commit 4c0473e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/app/containers/WalletProvider/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,19 +239,24 @@ function* testTransactionsPeriodically() {

function* addVisitSaga({ payload }: PayloadAction<string>) {
try {
yield call([axios, axios.post], backendUrl[currentChainId] + '/addVisit', {
let finalPayload: { walletAddress: string; cid?: string } = {
walletAddress: payload,
});
};
yield call(
[axios, axios.post],
backendUrl[currentChainId] + '/addVisit',
finalPayload,
);
const ga = yield window.cookieStore.get('_ga');
const cid = ga !== null ? ga.value.slice(6, ga.value.length) : null;
if (ga !== null) {
finalPayload.cid = ga.value.slice(6, ga.value.length);
}

const queryString = new URL(window.location.href).search;
yield call(
[axios, axios.post],
userLogUrl[currentChainId] + '/visit' + queryString,
{
walletAddress: payload,
cid: cid,
},
finalPayload,
);
} catch (error) {
log.error('failed to log visit', error);
Expand Down

0 comments on commit 4c0473e

Please sign in to comment.