Quick-Start Guide: Install Instructions for Tracking Snippet
This article will guide you through the process of installing UserIQ Tracking Snippet on your app. It also features a few FAQ's that you may find useful.
How do I install the UIQ Tracking Snippet?
*Please note that you should replace the text highlighted in green with variable names and not actual values. For example, consider all user id's in your app are stored in the variable named 'uid', then you replace (var user_id = 'INSERT_YOUR_APP_USER_ID_HERE') with (var user_id = uid) and not (var user_id = 1234)
Place it just before the </body> tag. Hopefully, you'll only need to add this to one file since it is the same on each page of your application.
What does a correct Tracking Snippet look like?
What does an incorrect Tracking Snippet look like?
Why and how do I install Tracking Snippet for a Single-Page Application?
Why: To properly split the tracking snippet between a static footer and dynamic variables in a single page application (using Angular, for example).
How: Installing UserIQ tracking code on Single Page Applications is a 2 step process. Failure in implementing step 2 would prevent you from using a) targeted campaign delivery and b) segmentation – as your users' information is passed to UserIQ only with a successful implementation of step 2.
You will use the following tracking snippet in your footer (this can be a static JS resource):
Here is a working example of a user authentication service (in Angular) that sets the user variables as soon as the user is logged in:
Angular Code Example:
You can make this call anywhere in your SPA and it will establish the user as identified.
Why should I implement Step 2?
What are Taboo Values?
Taboo values are essentially dummy values that are being passed into UIQ for tracking purposes and this excludes any personal data like email, username, etc. For example, if you would not want us to know the username of the users that are associated with the account, you can pass in values like <useriq-unknown> in your <user_name> custom variable which will essentially hide the username from our view.
If you need to pass a dummy value as you do not want to know the user’s information, we will automatically parse the following strings into nothing on our end.
What do we use these values for in UserIQ?
- User ID is a required value for UserIQ as it is the cornerstone for most of our analytics.
- Username is simply used for display purposes
- Account Id is used for associating users to accounts as well as accounts to organizations. This is a critical variable for anyone wanting to leverage account segmentation
- Account name is simply used for display purposes
- Signup date is used for a number of pre-populated segments and is required to be formatted as “YYYY-MM-DD”
- Email is used for a number of different segmentation options and to use the email campaign feature without importing lists.
Does it matter what type of value is passed to UserIQ?
Nope, we will cast all values to a String before sending it to our API which then converts them into proper formats depending on type.
What if I want to exclude a page from tracking?
This frequent request can be handled in a few ways. One way is to use the current method used by UserIQ and a few others when a login page does not need to be tracked:
What if my login is on a page I do want to track?
You're in luck! We have recently restructured our tracker to allow for users to initialize it once they know their data has returned. Here is a brief example:
How do I view Tracking Snippet information once it is installed?
Once the tracking snippet is installed properly and you are able to see the UIQ bubble on your app, you can have a look at it after logging in to UIQ App as well by visiting the following url: https://app.useriq.com/#!/tracking.
You can also look here for additional information on the tracking snippet.