Se reembolsará tras la entrega de tus 5 videos.
Se reembolsará tras la entrega de tus 5 videos.
in theme.liquid. */ (function () { var COOKIE = "alfavita_utm"; var DAYS = 30; function readCookie() { var m = document.cookie.match(new RegExp("(?:^|; )" + COOKIE + "=([^;]*)")); if (!m) return null; try { return JSON.parse(decodeURIComponent(m[1])); } catch (e) { return null; } } function writeCookie(data) { var d = new Date(); d.setTime(d.getTime() + DAYS * 24 * 60 * 60 * 1000); document.cookie = COOKIE + "=" + encodeURIComponent(JSON.stringify(data)) + "; expires=" + d.toUTCString() + "; path=/; SameSite=Lax"; } // 1. Capture UTMs from the landing URL (first-touch: don't overwrite) var params = new URLSearchParams(window.location.search); var source = params.get("utm_source"); if (source && !readCookie()) { writeCookie({ utm_source: source, utm_medium: params.get("utm_medium") || "", utm_campaign: params.get("utm_campaign") || "" }); } var utm = readCookie(); if (!utm || !utm.utm_source) return; var applied = false; // 2. Stamp the cart attributes so they land on the order function applyToCart() { fetch("/cart.js", { credentials: "same-origin" }) .then(function (r) { return r.json(); }) .then(function (cart) { if (!cart || cart.item_count === 0) return; // don't create empty carts if (cart.attributes && cart.attributes.utm_source === utm.utm_source) { applied = true; return; } return fetch("/cart/update.js", { method: "POST", credentials: "same-origin", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ attributes: { utm_source: utm.utm_source, utm_medium: utm.utm_medium, utm_campaign: utm.utm_campaign } }) }).then(function () { applied = true; }); }) .catch(function () {}); } applyToCart(); // 3. Re-apply after any add-to-cart, so the attribute is set even when // the visitor lands on an empty cart and adds a product later. var origFetch = window.fetch; window.fetch = function () { var url = arguments[0] && (arguments[0].url || arguments[0]); var p = origFetch.apply(this, arguments); if (typeof url === "string" && url.indexOf("/cart/add") !== -1) { p.then(function () { if (!applied) setTimeout(applyToCart, 300); }); } return p; }; var origOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function (method, url) { if (typeof url === "string" && url.indexOf("/cart/add") !== -1) { this.addEventListener("load", function () { if (!applied) setTimeout(applyToCart, 300); }); } return origOpen.apply(this, arguments); }; })();