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.
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