Created
February 24, 2020 19:41
-
-
Save cbarley10/8274718c234012243317402a7e20cd2f 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
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
$("button[type='submit']").click(function(e) { | |
// grab customer fields | |
var email = $('input#shippingEmail').val(); | |
var firstname = $('input#shippingFirstName').val(); | |
var company = $('#shippingCompanyName').val() || ""; | |
var lastname = $('input#shippingLastName').val(); | |
var address = $('input#shippingAddressOne').val(); | |
var address2 = $('input#shippingAddressTwo').val(); | |
var city = $('input#shippingAddressCity').val(); | |
var state = $('#shippingState').val(); | |
var zip = $('#shippingZipCode').val(); | |
// grab product fields | |
var productName = select product name here | |
var productURL = select product image url here | |
var productSKU = select product sku here | |
_learnq.push(["identify", { | |
"$email": email, | |
"$firstname": firstname, | |
"$lastname":lastname, | |
"$address": address, | |
"$address2": address2, | |
"$state": state, | |
"$zip": zip | |
}]); | |
_learnq.push(["track", "Started Checkout", { | |
productName: productName, | |
productURL: productURL, | |
productSKU: productSKU | |
}]) | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment