Integrate using Google Analytics
Did you know you can now use your Google Analytics checkout values to power your preezie pixel?
The below uses the default ecommerce GA set up, if you have any site customisation then use our GTM integration guide instead.
How it works
If you’re using Google Analytics for eCommerce tracking then you’ll have an event (often called ‘purchase’) firing whenever a sale is made. The purchase data within this event can also be passed to the preezie pixel at the same time.
Therefore by adding the code below to your checkout confirmation page you can pass the same data to preezie that is sent to your GA to also pass to preezie.
The code to add
In the code snippet below you will need to update two things:
Update the PRE-123456 value with your preezie id, this id can be found in your CMS by going to Code Snippets > Your preezie id:
Make sure the
"ga-purchase"
part matches your purchase event name after the ga- prefix. Note, this is case-sensitive!
e.g. if your event is called purchase it becomesga-purchase
if it’s called checkout it would bega-checkout
How do I know what my purchase event is called?
Most standard Google Analytics interations use purchase as the event name, but follow these steps below to check yours
Code snippet to copy:
<script>
!function(e,t,n,s,p,r){e.prz||((s=e.prz=function(){s.process?s.process.apply(s,arguments):s.queue.push(arguments)}).queue=[],s.t=+new Date,(p=t.createElement(n)).async=1,p.src="https://preeziecdn.azureedge.net/production/prz_pixel.min.js?t="+864e5*Math.ceil(new Date/864e5),(r=t.getElementsByTagName(n)[0]).parentNode.insertBefore(p,r))}(window,document,"script"),prz("init","PRE-123456");
</script>
<script>
window.addEventListener("load", function() {
prz("event", "transaction", "ga-purchase");
});
</script>
This code should now be added to your checkout confirmation page after the ‘purchase’ event has fired.
Here are two example ways to do this:
Using Google Tag Manager
In your GTM account create a Tag using Custom HTML
Paste in your code from above
It will look like this:
Now add a Trigger that fires this Tag on your checkout confirmation page (note this must fire after your GA purchase event), so an easy way to do this is to use the purchase event as the trigger. Follow these steps:
Create a purchase Trigger that uses a Custom Event of
purchase
It looks like this:
Hit Save
Now use the GTM preview feature to make a test transaction and see your Tag firing.
How do I find my GA purchase event name?
Using Google Tag Manager
If you have GTM then use Preview mode to make a test purchase on your site
In the Summary window you will see a purchase event fired, in the below example it’s called purchase (note the lower case)
If you can’t see purchase, click Data Layer tab and then each event in the Summary window to see which event contains the product details of the product that were purchased
Use this as you purchase event name (note this is case sensitive!), for example if it’s called transaction then use ga-transaction in your preezie code above
Using your web browser
Most web browsers now allow you to see the data created after a purchase is made.
Open your browser (e.g. Chrome or Edge) and make a test transaction
Now open up the browser’s Developer tools (Settings > More tools > Developer tools)
In this window type dataLayer and hit enter (note, this is case sensitive!)
You will see some events appear, open these up and look for the event which contains the product items that were bought
The name of this ‘event' can be taken directly from here: