-
Contents
Squarespace Google Analytics E-commerce Tracking
Setting up Google Analytics e-commerce tracking with Squarespace literally couldn't be easier. Copy your tracking ID from Google Analytics into the Advanced Settings on Squarespace and you're done!
Make sure you've got Enhanced E-commerce tracking enabled in Google Analytics and you're good to go, Squarespace does everything else for you. If you've ever installed e-commerce tracking on a different platform you'll know how much of a relief this is!
Custom Order Confirmation Page
Up to this point everything just works! But then you try and customise your order confirmation page and find there's very little you can change. The solution is to create a completely separate page in Squarespace to act as your order confirmation page.
With a single line of JavaScript code you'll be able to redirect customers from the default order confirmation page to your new page, giving you full control.
The Code
The key to not messing up your Google Analytics e-commerce tracking is to add a small delay between the default Squarespace order confirmation page being shown and the redirect being initiated.
Redirecting customers too fast means the Google Analytics tracking code won't have enough time to fire and you'll miss the transaction! Your Squarespace revenue tracking will continue to function as normal. This is an easy one to spot because you'll have a notable discrepancy between sales in Squarespace and transactions in Google Analytics.
In Squarespace got to Settings > Advanced > Code Injection and paste the following code into the Order Confirmation Page textarea (preferably below any other existing code).
<!-- Redirect customers to the registration page after 1 second -->
<script>setTimeout(function() {window.location.href="https://example.com/new-order-confirmation-page"}, 1000);</script>
This code will wait for 1 second before redirecting the customer to the new order confirmation page you created. Remember to update the URL with your own.