demarches-normaliennes/app/javascript/shared/track/sendinblue.js
2019-04-02 17:33:53 +02:00

22 lines
656 B
JavaScript

const { key, enabled, administrateur } = gon.sendinblue || {};
if (enabled) {
window.sib = {
equeue: [],
client_key: key,
email_id: administrateur.email
};
const script = document.createElement('script');
const firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.id = 'sendinblue-js';
script.async = true;
script.src = `https://sibautomation.com/sa.js?key=${window.sib.client_key}`;
firstScript.parentNode.insertBefore(script, firstScript);
window.sib.equeue.push({ page: [] });
window.sib.equeue.push({
identify: [administrateur.email, administrateur.payload]
});
}