IsabelFurtado Posted December 11, 2019 Posted December 11, 2019 Hi there! I'd like to set up Google Analytics event tracking on a form submission button and other buttons that are not related to e-commerce. What is the best way to do that with code injection? I've been using Google Tag Manager with my previous site, and I know how to create G.A. event tracking there. Installing GTM was my first option, but Google's documentation says that the second part of the code should go immediately after the <body> opening tag, and the squarespace code injection only gives me the option to add it to the footer (I believe it means just before closing the </body> tag). So I'm not sure it's going to work fine. Has anyone here done it?
tuanphan Posted December 13, 2019 Posted December 13, 2019 17 hours ago, IsabelFurtado said: Can anyone help with this? 🙄😊 the squarespace code injection only gives me the option to add it to the footer (I believe it means just before closing the </body> tag) Yes. Code in Footer will be in <body> and </body> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
TheyreBrill Posted October 24, 2020 Posted October 24, 2020 Also looking for an answer to OP's question asillince 1
asillince Posted September 27, 2023 Posted September 27, 2023 I would also love an answer to this - I want to track additional events on my Squarespace site based on interactions with certain form blocks, to be able to mark them as conversions. Struggling to find anything online that suggests that's possible. I'm using 7.1 and GA4
JoanGarroway Posted September 28, 2023 Posted September 28, 2023 Setting up event tracking with Google Analytics on Squarespace is doable using code injection. Even if Squarespace primarily offers footer injection, you can still make it work. U can add your Google Tag Manager container code through the Squarespace code injection in the footer. Then, for event tracking on specific buttons, you can use JavaScript and fire the events based on button clicks. Use JavaScript to trigger events for your buttons, and push those events to GTM document.getElementById('your-button-id').addEventListener('click', function() { dataLayer.push({ 'event': 'your-event-name' }); }); Replace your-button-id with the actual ID of ur button, and 'your-event-name' with a relevant event name yeah, it's a bit manual compared to GTM, but it'll work 😅 Be nice, and don't forget to like or upvote my replies if they were helpful 🌸
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment