/* Configuration for Google Analytics */ const googleAnalyticsCurrency = 'AUD'; // Currency to send purchases in /* DO NOT EDIT BELOW THIS LINE unless you know what you're doing */ // Extract URL parameters const params = new URLSearchParams( window.location.search ); const transactionId = params.get( 'OrderId' ); // If OrderId exists in URL, proceed if ( transactionId ) { const revenue = params.get( 'Revenue' ); const shipping = params.get( 'Shipping' ); const tax = params.get( 'Tax' ); let items = []; // Add purchases to items array for ( let i = 1; ; i++ ) { let productId = params.get( `Item${i}Id` ); // Break loop if product id does not exist if ( !productId ) { break; } let productName = decodeURIComponent( params.get( `Item${i}Name` ) ).replace( /\+/g, ' ' ); let productSku = productId; let productPrice = params.get( `Item${i}Price` ); let productQuantity = params.get( `Item${i}Quantity` ); // If product price and quantity exist, add them to the items array if ( productPrice && productQuantity ) { items.push( { item_id: productSku, item_name: productName, price: productPrice, quantity: productQuantity } ); } else { break; } } // Send GA4 purchase event gtag( 'event', 'purchase', { currency: googleAnalyticsCurrency, transaction_id: transactionId, value: revenue, shipping: shipping, tax: tax, items: items } ); }
YAY!
Congratulations
for Investing in Yourself
Check your email for all the details
We look forward to seeing you for the next event!
xx
[bot_catcher]