Hey,
According to this previous topic (UTMs de marketing estão sendo passadas para o checkout), @rsantos back in Jun '22 seems to have found the solution with the code below:
function addMarketingData() {
var IPS = getIPS()
var utms = {
utmCampaign: (IPS.indexOf('Campanha') != -1 ? IPS.split('Campanha=')[1].split('&')[0] : ""),
utmMedium: (IPS.indexOf('Midia') != -1 ? IPS.split('Midia=')[1].split('&')[0] : ""),
utmSource: (IPS.indexOf('Parceiro') != -1 ? IPS.split('Parceiro=')[1].split('&')[0] : ""),
}
vtexjs.checkout.sendAttachment('marketingData', utms);
}
function getIPS() {
var IPS;
document.cookie.split(';').forEach(function (cookie) {
if(cookie.includes("IPS")){
IPS = cookie;
}
});
return IPS;
}
I’d like to know, if someone or @rsantos themselves could help me out — where exactly do I insert this code, and what’s the correct way to do it, inside the <script> tag?
Apologies, but I’m in a production environment and can’t afford to get this wrong.
Thanks, and let’s keep it going.