{ if (eventName === "Purchase") { const tokenDataAsString = localStorage.getItem("google_rwg_token"); if (tokenDataAsString === null) { return } try { const { rwgToken, lastUpdate } = JSON.parse(tokenDataAsString) if (isTimestampOlderThan30Days(lastUpdate)) { return } fetch("https://www.google.com/maps/conversion/collect", { method: "POST", body: JSON.stringify({ conversion_partner_id: WIX_PARTNER_ID, rwg_token: rwgToken, merchant_changed: 2 }) }); } catch (err) { console.error("failed to report Google Maps API conversion event", { tokenDataAsString }) } } }) } function isTimestampOlderThan30Days(timestamp) { const thirtyDaysInMilliseconds = 30 * 24 * 60 * 60 * 1000; const currentTimestamp = Date.now(); return (currentTimestamp - timestamp) > thirtyDaysInMilliseconds; } })()
top of page

Nuestros servicios

bottom of page