Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JulianJorgensen/f2b573602ed3110db8e8bdb5f47984f4 to your computer and use it in GitHub Desktop.
Save JulianJorgensen/f2b573602ed3110db8e8bdb5f47984f4 to your computer and use it in GitHub Desktop.
Inspration checkout API integration
const sendEvent = (productId) => {
const clientId = getClientId(); // GA client id
if (!clientId) {
return;
}
const body = {
action: "purchase",
product_id: `${productId}`,
ids: [`ga:${clientId}`]
};
fetch(`${API_URL}/events/`, { // API_URL https://rec.ingka.com/services/fr-feed-staging
method: "POST",
headers: { "Content-Type": "application/json;charset=utf-8" },
body: JSON.stringify(body)
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment