Event Tracking

Event tracking allows you to track important user actions on your site. Such as Upgraded plan or Used feature X. You can also track events when a user views an important page (e.g. Viewed pricing page) to make is easy to segment users that have viewed that page in People CRM.

Popular events also show up in the 'Events' widget in the Trends dashboard.

What events can I track?

The Javascript event tracking code allows you to track a GoSquared event using any of the standard HTML event handlers (eg onclick, onscroll, onchange etc etc).

See a full list of HTML event handlers.

You can also track an event when users view an important page in the customer journey, such as viewing the pricing page. Tracking an event on these pages will make it easier to segment users that have preformed this action in People CRM.

For developers: If you have a developer on the team you can track server side events through our tracking API.

How many different event names/types can I track?

GoSquared allows you to track up to 1000 unique event types/names per project. For example if you were tracking 4 events, each called:

  1. Clicked Like Button
  2. Uploaded Avatar
  3. Logged In
  4. Viewed pricing page (or another important page)

These events all have unique names, therefore 4 of your 1000 event types limit would be used up.

Example Code

These example assumes you've already added the Analytics code snippet to your site. You can track an event using the GoSquared event code.

Basic event tracking looks like this, where you can customise the Name of the event

_gs('event', 'Name of the event')

Note: the event code will only work if it is added lower down the page than the main Analytics code. This is why it's a good idea to install the main Analytics code snippet in the <header> of you site.

Track an important pageview – e.g. your pricing page

In People CRM, segmenting your users based on which pages they have viewed is currently limited to just their landing page, and their last (most recently) viewed page.

If you need to segment your users based on if they've viewed any other specific pages, such as the signup page, or the pricing page etc, then we recommend you track a custom event on the page. You can then segment users based on them having tracked the Viewed pricing page event, for example.

To do this, you just need to add the basic event code to the pricing page you want to track. Providing the event code is further down the webpage than the main Analytics code snippet, it should just work.

_gs('event', 'Viewed pricing page')

You could add this code directly beneath the main Analytics code snippet (on that specific page), or you could put it further down the page in the body, wrapped in <script> tags like this:

_gs('event', 'Viewed pricing page')

Note: pageviews can happen quite frequently, so we recommend you only use this on your important pages to avoid cluttering your People CRM data with lots of repetitive events. Remember that each project has a limit of 1000 custom events names!

Tracking a button click

A common example is tracking when a user clicks a button. You would need to use the 'onclick' event handler to trigger the GoSquared event like this:

<button onclick="_gs('event', 'Clicked like button')">Like</button>


Button event tracking example

Tracking a download link

If you wanted to track when somebody clicks a link, the same principles apply. You would use an 'onclick' event handler within the link element:

<a href="pdfdownloadlink.pdf" onclick="_gs('event', 'Downloaded PDF')">Download PDF here</a>


Button event tracking example


Check it works

Check the Events widget in your Trends dashboard to see you can see the correct event name. Alternatively view the activity feed of the relevant person in People CRM.

Learn how to get notified when a user tracks an event with our guide to Smart Group notifications.


Tracking Events from the Server

If you have a developer on your team, they may be interested in setting up server-side event tracking using our Tracking API.


How can I view events that I am tracking with GoSquared?

GoSquared event tracking is shown on a per-visitor basis in real-time.

In Trends, you can view a summary of the top fired events over a given timeframe, enabling you to quickly gain a good understanding of the actions your visitors are taking between pageviews.

Did you find this article helpful?