Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Conditioned Goals for Blogpost
// Click on Navigation/Menu & check location
if (window.location.match("url.de/foo/product-category")) {
document.querySelector("#element").addEventListener("mousedown", function() {
sessionStorage.setItem("nav-click", true);
});
}
// Breadcrumb
if (window.location.href.match("url.de/foo/product-overview") && document.referrer.match("url.de/foo/product-category") && sessionStorage.getItem("nav-click")) {
console.log("proceed");
} else if (window.location.href.match("url.de/foo/product-pdp") && document.referrer.match("url.de/foo/product-overview") && sessionStorage.getItem("nav-click")) {
console.log("proceed");
} else {
sessionStorage.setItem("nav-click", false);
}
// Add-to-Cart Listener at PDP
if (window.location.href("url.de/foo/product-pdp") && sessionStorage.getItem("nav-click") == "true") {
document.querySelector("#addToCartButton").addEventListener("mousedown", function() {
console.log("process conversion");
sessionStorage.setItem("nav-click", false);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.