...
Purchase (with an option to fire after initial sale or after all upsells)
Checkout Champ by default sends only transaction data to Google. If using Tag Manager (GTM) you have an option to also send enhanced conversion data. Use the 2 steps below (do this even if using only the Tracking Id entry).
https://support.google.com/google-ads/answer/12785317
Step 1: Add the following to the custom head tracking code
Code Block | ||
---|---|---|
| ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sha256/0.9.0/sha256.min.js" integrity="sha512-szJ5FSo9hEmXXe7b5AUVtn/WnL8a5VofnFeYC2i2z03uS2LhAch7ewNLbl5flsEmTTimMN0enBZg/3sQ+YOSzQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> |
Step 2: Add the following to the custom body tracking code
Code Block | ||
---|---|---|
| ||
<script type="text/javascript">
$(document).ready(function () {
function getHash(param) {
var value = param && param.trim();
if (!value) {
return "";
}
return sha256(value);
}
try {
var serializedOrderData = sessionStorage.getItem("orderData");
if (!serializedOrderData) {
return;
}
var orderData = JSON.parse(serializedOrderData);
var emailAddress = orderData.emailAddress;
var firstName = orderData.firstName;
var lastName = orderData.lastName;
var city = orderData.city;
var country = orderData.country;
var postalCode = orderData.postalCode;
if (gtag && emailAddress && firstName && lastName && city && country && postalCode) {
gtag("set", "user_data", {
"sha256_email_address": getHash(emailAddress),
"address": {
"address.sha256_first_name": getHash(firstName),
"address.sha256_last_name": getHash(lastName),
"city": city,
"postal_code": postalCode,
"country": country
}
});
}
} catch(error) {
console.log(error);
}
});
</script> |
...