Created
November 5, 2019 15:27
-
-
Save JulianJorgensen/f2b573602ed3110db8e8bdb5f47984f4 to your computer and use it in GitHub Desktop.
Inspration checkout API integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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