Squarespace, AJAX & Google Analytics

Squarespace is great, AJAX is great, Google Analytics is great. But they don’t always play nice together on Squarespace websites. If you don’t know, AJAX makes your website feel much faster and snappier. When a user clicks on a new page, instead of re-loading the whole page again, Squarespace only loads the content that has changed on the page.

But this presents a problem, header and footer elements are never re-loaded because they never change. This means that your Google Analytics code won’t update and page views won’t be logged. But don’t worry there is a way around this by utilising Google Tag Manager.

This isn’t necessary if you’re on version 7.1 of Squarespace, you can use the built-in Google Analytics integration.

Step-By-Step Guide

1. Log into Google Tag Manager.

2. Install Google Tag Manager on your Squarespace website. Navigate to Admin > Install Google Tag Manager.

Squarespace Website Designer UK
 

3. Copy and paste the first section of code into your sites Global Code Injection Header. Then copy and paste the second section of code in your sites Global Code Injection Footer.

Squarespace Website Designer UK
 

4. Navigate back to Workspace, click on Triggers & finally click New.

Squarespace Website Designer UK
 

5. Click ‘Choose a trigger type to begin set-up…’.

Squarespace Website Designer UK
 

6. Scroll down to the bottom of the list and select History Change.

Squarespace Website Designer UK
 

7. Click Save and then Save again.

Squarespace Website Designer UK

8. Now navigate to Tags and then click on New.

Squarespace Website Designer UK
 

9. Click on ‘Choose a tag type to begin set-up…’.

Squarespace Website Designer UK
 

10. Now click on ‘Google Analytics: Universal Analytics’.

Squarespace Website Designer UK
 

11. Make sure that ‘Track Type’ is set to ‘Pageview’ and that ‘Google Analytics settings’ is set to ‘{{Google Analytics Settings}}’. Finally, click on ‘Choose a trigger to make this tag fire…’ in the section below.

Squarespace Website Designer UK
 

12. Click on ‘Change History’.

Squarespace Website Designer UK
 

13. Now click on the ‘+’ button.

Squarespace Website Designer UK
 

14. Click on ‘All Pages’.

Squarespace Website Designer UK
 

15. Now click ‘Save’.

Squarespace Website Designer UK
 

16. Click ‘Save’ again.

Squarespace Website Designer UK
 

17. Click ‘Submit’ or ‘Publish’.

Squarespace Website Designer UK
 

18. Click ‘Publish’.

Squarespace Website Designer UK
 

19. Give it a name and click ‘Continue’.

Squarespace Website Designer UK
 

That’s it, Google Analytics is now set-up to work on your AJAX enabled Squarespace website.

 
Previous
Previous

Fixed Header In Brine