Skip to content

Commit

Permalink
fix: Tracking properties not working
Browse files Browse the repository at this point in the history
  • Loading branch information
chavda-bhavik committed Oct 4, 2024
1 parent d2c18aa commit 23d0983
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions apps/widget/src/util/amplitude/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
import { AMPLITUDE } from '@config';

export const initAmplitude = (id: string) => {
window.amplitude?.init(id, undefined, {
defaultTracking: { sessions: true, formInteractions: true },
window.amplitude?.init(id, {
autocapture: {
attribution: false,
pageViews: false,
sessions: false,
formInteractions: false,
fileDownloads: false,
elementInteractions: false,
},
});
// const sessionId = window.amplitude.getInstance().getSessionId();
};

export const identifyImportIntent = ({}: { templateId?: string; projectId: string }) => {
logAmplitudeEvent('IMPORT_INTENT');
export const identifyImportIntent = (props: { templateId?: string; projectId: string }) => {
logAmplitudeEvent('IMPORT_INTENT', props);
};

export const startAmplitudeSession = (id: string) => {
export const startAmplitudeSession = (id: number) => {
window.amplitude?.setSessionId(id);
};

export const logAmplitudeEvent = (eventType: keyof typeof AMPLITUDE, eventProperties?: any) => {
window.amplitude?.track({ event_type: eventType, eventProperties });
window.amplitude?.track({ event_type: eventType, event_properties: eventProperties });
if (eventProperties && eventProperties.email) window.amplitude.setUserId(eventProperties.email);
};

export const resetAmplitude = () => {
Expand Down

0 comments on commit 23d0983

Please sign in to comment.