Created
May 31, 2024 14:47
-
-
Save wurwal/9b6bd12affb57108fec1338b5c2c5b25 to your computer and use it in GitHub Desktop.
add to thank you page
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
<script> | |
jQuery(document).ready(function() { | |
// Function to retrieve cookie value by name | |
function getCookie(name) { | |
var cookies = document.cookie.split(';'); | |
for (var i = 0; i < cookies.length; i++) { | |
var cookie = cookies[i].trim(); | |
// Check if this cookie is the one we are looking for | |
if (cookie.indexOf(name + '=') === 0) { | |
// Return the cookie value | |
return cookie.substring(name.length + 1); | |
} | |
} | |
// Return null if cookie not found | |
return null; | |
} | |
// Retrieve the value of the cookie | |
var ec_email_cookie = getCookie('ec_email_cf'); | |
console.log(ec_email_cookie); // Check the value in the console | |
dataLayer.push({ | |
'event':'ec_formsubmit', | |
'enhanced_conversion_data': { | |
"email": ec_email_cookie | |
} | |
}) | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment