AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
1.7K members online now
1.7K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

Event Tracking in Squarespace

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm currently learning to work with Google Analytics and in order to speed that process along, I have begun to look at a friends data for a Squarespace site. The first thing I'd like to do is: I want to track a goal of having users click the "Donate" button (it's a non-profit). Can anyone walk me through how to set this up? Do I need technical skills or am I just plugging in a tracking code somewhere? Thanks in advance for the help!

Event Tracking in Squarespace

Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆

Hi Patrick,

 

Basic idea is triggering a Google Analytics Event command when user clicks on your "Donate" button. You need a little programming skills. 

 

Example GA event command: ga('send', 'event', 'Event_Category', 'Event_Action', 'Event_Label', Event_Value);

You don't have to set an event value if you dont want to assign one.

For Caregory, Action and Label you can set the values that you want to send to your GA Property.

 

You can do it as follows if you are not using GTM:

Let's say your donate button html element has an id of "donateButton"

<script>
document.getElementById("donateButton").addEventListener("click", function(){
  ga('send', 'event', 'Donation', 'Click', 'some more detail');
});
</script>

 

or

 

<button onclick="ga('send', 'event', 'Donation', 'Click', 'some more detail');">Donate</button>

 

You can read more about Google Analytics events through following link: https://developers.google.com/analytics/devguides/collection/analyticsjs/events

 

Please let me know if you have further questions.

I hope this helps.

Regards

Event Tracking in Squarespace

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you so much for your reply, I really do appreciate it! Because this is all so new to me and I don't want to mess anything up with my friend's page, I have included a couple pieces of follow up info and questions below. I am not sure if you are familiar with Squarespace, but if so, I'd really appreciate any direction you can provide. Thank again!!
- the website I'm working with is http://trekcoalition.org/ , if you'd like to look for reference
- the address of the outbound link is https://app.etapestry.com/onlineforms/FIBUSPAMInc/Trek.html
- the "Donate" button is on a few pages, but i'll just focus on the home page for right now

- once the code is put together, this would be injected into the header, correct?

- is it possible for you to provide a more specific answer based on the info i have provided? would you need more? I just need to see how it works the first time and then i feel that i could take it from there.

 

Once again, thank you for your time!!

Event Tracking in Squarespace

Participant ✭ ✭ ☆
# 4
Participant ✭ ✭ ☆

Hi @Patrick M

 

I took a look into your website. You It is a little tricky with suqarespace but I managed to do it.

 

If you inject the code below to your head tag on the pages that you have your 'donate' button, it will start tracking the clicks on it.

 

<script>
Y.on("domready",function(){
   Y.all("a[href*='etapestry.com/onlineforms/FIBUSPAMInc'] span").each(function(){
      this.on('click',function(e){
         if(_gaq){
            e.preventDefault();
            var targetURL = this.getAttribute("href");
            _gaq.push(['_trackEvent','Outbound Links', 'Donate Button', 'https://app.etapestry.com/onlineforms/FIBUSPAMInc/Trek.html']);
            setTimeout(function(){window.open("https://app.etapestry.com/onlineforms/FIBUSPAMInc/Trek.html");},150);
         }
     });
   });
});
</script>

 

Please let me know if you have any questions

 

I hope this solves your problem! Smiley Happy

Regards,

Güney