Skip to content

Instantly share code, notes, and snippets.

@KelvinJin
Last active August 28, 2015 06:26
Show Gist options
  • Save KelvinJin/cafe9457f956d7a323b1 to your computer and use it in GitHub Desktop.
Save KelvinJin/cafe9457f956d7a323b1 to your computer and use it in GitHub Desktop.
Tracking Info

In order to enable xLabs Analytics to track your website, the following tracking script needs to be properly installed.

Note: Since our embedded javascript depends on jQuery 1.11.2+, you will need to import jQuery as well. However, most of the modern websites will have jQuery imported on every page. Here is a simple example of how jQuery is imported.
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>

The following is your tracking code. Copy and paste it into the code of every page you want to track.

<script type="text/javascript" src="http://xlabs-admin.uthoft.com/assets/js/xLabsAnalytics.js"></script>
<script type="text/javascript">xa.start();</script>

Tips: The best place to put the code snippet is right before the </body> tag.
Tips: If you want to track every page of your website, put the tracking code inside a global template file.

Tracking components

To enable xLabs Analytics to track a certain component, you need to set a unique identifier for such a component.

For instance, adding a xa_track attribute to specify the unique identifier(name) of the figure like this.

<figure xa_track="name: Strawberry;">
...					
</figure>

Note: The name is used later for you to identify the component, so it must be unique across the whole page for a component.

Tips: It's not recommanded to add a component to track if it's too small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment