Analytics and Assistant

Getting started with GoSquared is as simple as adding a small JavaScript snippet to your site. The code snippet below powers Analytics and optionally loads the live chat Assistant. Just copy and paste it into every page you'd like to track, just before the </head> tag.

You will need to replace the GSN-123456-A parameter with the token of the project you wish to track. You can find this token, along with this tracking snippet, by going to the Setup Guide.

Pageview tracking is currently only available though our JavaScript Analytics Code (or our plugins) but not via any libraries.

Note: this code snippet will only load the GoSquared Assistant if you have Assistant turned ON in Settings > Current Project > Assistant.

<script>
  !function(g,s,q,r,d){r=g[r]=g[r]||function(){(r.q=r.q||[]).push(
arguments)};d=s.createElement(q);q=s.getElementsByTagName(q)[0];
d.src='//d1l6p2sc9645hc.cloudfront.net/tracker.js';q.parentNode.
insertBefore(d,q)}(window,document,'script','_gs');

_gs('GSN-123456-A');
</script>

The tracking code will load asynchronously and automatically track a pageview. If you'd like to change this default behaviour, please see our full API documentation.

Full example page

Below is an example page to show where the tracking code should be installed in context with everything else.

<!DOCTYPE html>
<html>
  <head>
    <title>This is my website</title>

    <!-- GoSquared Analytics Code -->
    <script>
      !function(g,s,q,r,d){r=g[r]=g[r]||function(){(r.q=r.q||[]).push(
      arguments)};d=s.createElement(q);q=s.getElementsByTagName(q)[0];
      d.src='//d1l6p2sc9645hc.cloudfront.net/tracker.js';q.parentNode.
      insertBefore(d,q)}(window,document,'script','_gs');

      _gs('GSN-123456-A');
    </script>
    <!-- End GoSquared Analytics Code -->
  </head>

  <body>
    The rest of my website is here
  </body>
</html>

Next Steps