Using tags in FanExam

Can I add tags to the FanExam JavaScript snippet?
Tags are a feature of FanExam that allow you to segment your NPS responses by tag. For example, if you have customers on a “Silver” and a “Gold” plan, you can add the tags “silver” and “gold” to the JavaScript snippet. Once you have done this, you can analyze the responses per tag in the dashboard. Just select the appropriate tag in the top left of the dashboard.

tags in the FanExam dashboard
Select tags in the FanExam dashboard

In order to see the tags in the dashboard, you must send the tags into FanExam when the JavaScript snippet is loaded.


<script>
$FE = {id:2};
// The identifier $FE.email is a JavaScript string. Backslashes must be escaped as double backslashes.
// $FE.email is not case sensitive: "John@example.com" and "john@example.com" are equal.
$FE.email = ""; // input user unique identifier - email recommended - in these quotes (not case sensitive)
$FE.tags = "gold"; // tags go in these quotes separated by commas
$FE.lang = "en-us"; // language + locale to be used
(function(d) {
var ca = d.createElement("script"),t;
ca.type = "text/javascript";
ca.async = true;
ca.src = "//tag.fanexam.com/exam.js";
t = d.getElementsByTagName("script")[0];
t.parentNode.insertBefore(ca, t);
})(document);
</script>

Please pay attention to the line

$FE.tags = "gold"; // tags go in these quotes separated by commas

You must add these tags yourself to the snippet. This can be done by e.g. a server language like Ruby (on Rails), Php, or Python. You can also use multiple tags with a single customer, e.g. for a a specific plan (“gold”) and a location (“us”), which would result in this line:

$FE.tags = "gold, us"; // tags go in these quotes separated by commas

Javascript Snippet FAQ

Is the user email a necessary parameter in the JavaScript Snippet?

For accurate measurement, this parameter is necessary.  This way we can make sure that we are not presenting the survey to the same user more than once within defined time period.  This parameter is not necessary if you have a content website without logged-in users.

I would prefer not to use my user’s email accounts – may I use my own primary key?

Yes, you can.  We do recommend using your client’s email address, because this way you can apply automation based on their feedback straight through FanExam.  Please do note that this parameter is not case sensitive.

If you use the email of one of your clients, be aware that you must have consent from your clients to collect and work with their personal data in this way.