Created
November 13, 2024 16:50
-
-
Save mrandyclark/2194f012600a83a96e9d3edcc7579691 to your computer and use it in GitHub Desktop.
This file contains 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
analytics.subscribe("checkout_completed", (event) => { | |
var script = document.createElement('script'); | |
script.onload = function() { | |
const cacheBust = Math.random() * 10000000000000; | |
const total = event.data.checkout.totalPrice.amount; | |
const email = event.data.checkout.email; | |
const orderId = event.data.checkout.order.id; | |
const protocol = "https:" === document.location.protocol ? "https://" : "http://"; | |
const imageUrl = `${protocol}trkn.us/pixel/c?ppt=24332&g=purchase&gid=60337&cv1=${orderId}&rev=${total}&ord=${cacheBust}&v=120` | |
const x = document.createElement("IMG"); | |
x.setAttribute("src", imageUrl); | |
x.setAttribute("width", "1"); | |
x.setAttribute("height", "1"); | |
document.body.appendChild(x); | |
} | |
script.src = document.location.protocol + '//trkn.us/pixel/c'; | |
script.async = true; | |
document.head.appendChild(script); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.js
in the url, where the original code does.