Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Google Analytics Base Code -->
- <script async src="https://www.googletagmanager.com/gtag/js?id=UA-126316797-1"></script>
- <script>
- window.dataLayer = window.dataLayer || [];
- function gtag(){dataLayer.push(arguments);}
- gtag('js', new Date());
- gtag('config', 'UA-126316797-1', { // Paste your property ID here from the example gtag script - note it ALSO goes above!
- 'linker': {
- 'domains': [ 'lab41.co', 'kathreadwrites.com', 'commerce.thrivecart.com', 'checkout.lab41.co'], // Change these to point to your multiple domains
- 'accept_incoming': true
- }
- });
- </script>
- <!-- Google Analytics Base Code -->
- <!-- Google Analytics Product Info Code -->
- <script>
- (function() {
- if(typeof _thrive_order === 'undefined') return;
- var items = [];
- if(typeof _thrive_order.order.product !== 'undefined') { // Product block
- items.push({
- 'id': _thrive_order.order.product.id,
- 'name': _thrive_order.order.product.name,
- 'quantity': _thrive_order.order.product.quantity,
- 'price': _thrive_order.order.product.total_readable
- });
- }
- if(typeof _thrive_order.order.bump !== 'undefined') { // Bump block
- items.push({
- 'id': _thrive_order.order.bump.id,
- 'name': _thrive_order.order.bump.name,
- 'quantity': _thrive_order.order.bump.quantity,
- 'price': _thrive_order.order.bump.total_readable
- });
- }
- var f = function(type) {
- if(typeof _thrive_order.order[type] !== 'undefined') {
- for(var x in _thrive_order.order[type]) {
- if(!_thrive_order.order[type].hasOwnProperty(x)) continue;
- items.push({
- 'id': _thrive_order.order[type][x].id,
- 'name': _thrive_order.order[type][x].name,
- 'quantity': _thrive_order.order[type][x].quantity,
- 'price': _thrive_order.order[type][x].total_readable
- });
- }
- }
- };
- f('upsells'); // Handle all upsells
- f('downsells'); // Handle all downsells
- gtag('event', 'purchase', {
- 'transaction_id': _thrive_order.order.invoice_id,
- 'value': _thrive_order.order.total_readable,
- 'currency': _thrive_order.order.currency,
- 'tax': _thrive_order.order.tax_readable,
- 'shipping': _thrive_order.order.shipping,
- 'items': items
- });
- })();
- </script>
- <!-- Google Analytics Product Info Code -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement