Last active
August 15, 2020 12:27
-
-
Save marcfowler/576b726b5c4e14fb9f9369e8a911b62f to your computer and use it in GitHub Desktop.
ThriveCart: Help: Google Analytics Ecommerce code
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> | |
(function() { | |
ga('require', 'ecommerce'); | |
ga('ecommerce:addTransaction', { | |
'id': _thrive_order.order.id, | |
'revenue': _thrive_order.order.total, | |
'tax': _thrive_order.order.tax, | |
'currency': _thrive_order.order.currency | |
}); | |
ga('ecommerce:addItem', { | |
'id': _thrive_order.order.id, | |
'name': _thrive_order.order.bump.name, | |
'sku': _thrive_order.order.product.id, | |
'price': _thrive_order.order.bump.total, | |
'quantity': '1' | |
}); | |
ga('ecommerce:send'); | |
})(); | |
</script> |
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> | |
(function() { | |
ga('require', 'ecommerce'); | |
ga('ecommerce:addTransaction', { | |
'id': _thrive_order.order.id, | |
'revenue': _thrive_order.order.total, | |
'tax': _thrive_order.order.tax, | |
'currency': _thrive_order.order.currency | |
}); | |
(function(downsell_id) { | |
ga('ecommerce:addItem', { | |
'id': _thrive_order.order.id, | |
'name': _thrive_order.order.downsells[downsell_id].name, | |
'sku': _thrive_order.order.downsells[downsell_id].id, | |
'price': _thrive_order.order.downsells[downsell_id].total, | |
'quantity': '1' | |
}); | |
})(DOWNSELL_ID_HERE); // Replace with your downsell ID! | |
ga('ecommerce:send'); | |
})(); | |
</script> |
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> | |
(function() { | |
ga('require', 'ecommerce'); | |
ga('ecommerce:addTransaction', { | |
'id': _thrive_order.order.id, | |
'revenue': _thrive_order.order.total, | |
'tax': _thrive_order.order.tax, | |
'currency': _thrive_order.order.currency | |
}); | |
ga('ecommerce:addItem', { | |
'id': _thrive_order.order.id, | |
'name': _thrive_order.order.product.name, | |
'sku': _thrive_order.order.product.id, | |
'price': _thrive_order.order.product.total, | |
'quantity': '1' | |
}); | |
ga('ecommerce:send'); | |
})(); | |
</script> |
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> | |
(function() { | |
ga('require', 'ecommerce'); | |
ga('ecommerce:addTransaction', { | |
'id': _thrive_order.order.id, | |
'revenue': _thrive_order.order.total, | |
'tax': _thrive_order.order.tax, | |
'currency': _thrive_order.order.currency | |
}); | |
(function(upsell_id) { | |
ga('ecommerce:addItem', { | |
'id': _thrive_order.order.id, | |
'name': _thrive_order.order.upsells[upsell_id].name, | |
'sku': _thrive_order.order.upsells[upsell_id].id, | |
'price': _thrive_order.order.upsells[upsell_id].total, | |
'quantity': '1' | |
}); | |
})(UPSELL_ID_HERE); // Replace with your upsell ID! | |
ga('ecommerce:send'); | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment