Basic Implementation

The first part of the two step integration with Parse.ly tracking, is the installation of the tracking code. Jump to documentation about the metadata tag once you have the JavaScript running!

The Parse.ly Tracker is a small piece of JavaScript code that monitors user actions taken on your site and relays them to the Parse.ly analytics server.

To get started, insert the Parse.ly Tracker in the footer of your website template. Ideal placement is as the last code block before the closing of the body tag. If your website uses a templating system, this is usually in the “footer” template.

<!-- START Parse.ly Include: Standard -->
<div id="parsely-root" style="display: none">
  <span id="parsely-cfg" data-parsely-site="##########"></span>
</div>
<script>
    (function(s, p, d) {
      var h=d.location.protocol, i=p+"-"+s,
          e=d.getElementById(i), r=d.getElementById(p+"-root"),
          u=h==="https:"?"d1z2jf7jlzjs58.cloudfront.net"
          :"static."+p+".com";
      if (e) return;
      e = d.createElement(s); e.id = i; e.async = true;
      e.src = h+"//"+u+"/p.js"; r.appendChild(e);
    })("script", "parsely", document);
</script>
<!-- END Parse.ly Include: Standard -->

Copy and paste the code block above. Notice that there is a configuration tag (parsely-cfg) which has a data property, data-parsely-site=”##########”. You must replace the “##########” with your own site domain name, e.g. “mysite.com”.

This ensures that no matter what host name your Parse.ly tag appears on, all the traffic data gets aggregated into a single account. You can get a version of the code that is already customized for your account in the dashboard.

Staging site and recommendations

Note: If you intend to also use the Parse.ly recommendations then staging site should not run the Tracking Code as all tracked pages are scraped for content and then used in the suggestions.

Optimizing tracker placement

If you are curious about the optimal placement of tracker code on your website, you can take a look at this article on how tracking scripts affect page loads.