Skip to content

Commit

Permalink
endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
artlu99 committed Jul 1, 2024
1 parent 3a56ae1 commit c576460
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions functions/shared/posthog.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Env } from '../common';

const sendPosthogEvent = async (env: Env, event: string, distinct_id: string) => {
const url = env.REACT_APP_PUBLIC_POSTHOG_HOST;
const url = env.REACT_APP_PUBLIC_POSTHOG_HOST + '/capture/';
const api_key = env.REACT_APP_PUBLIC_POSTHOG_KEY;

const timestamp = new Date().toISOString();
Expand All @@ -15,16 +15,13 @@ const sendPosthogEvent = async (env: Env, event: string, distinct_id: string) =>
};

try {
console.log('posthog attempt', JSON.stringify(payload));

const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload),
});

const data = await response.json();
console.log('posthog success', data);
await response.json();
} catch (e) {
console.error('posthog error', e);
}
Expand Down

0 comments on commit c576460

Please sign in to comment.