All Collections
Nickelled Interactive (Advanced) Guides
Installation
Do I have to pass user ID to use Nickelled Interactive Guides?
Do I have to pass user ID to use Nickelled Interactive Guides?

How to use the userId attribute in the Nickelled snippet

cyndi@nickelled.com avatar
Written by cyndi@nickelled.com
Updated over a week ago

We suggest that you should always pass in a userId attribute with the Nickelled Interactive Guides javascript snippet. It helps us to track who has seen each Flow, and allows you to finetune who you wish to show Flows to.

However, you don't have to pass a user ID to use Flows. If you remove the userId from the settings object, we will generate a random one and place it in a cookie.

The cookie provides some persistence. However, the downside to this approach vs populating the userId yourself is that when the user switches browser or clears cookies, they will look like a new user. This may result in them seeing the same flow again.

The recommended installation with userId completed will look something like the following:

<script type="text/javascript">
(function () {
var NickelledLaunchers = window.NickelledLaunchers = NickelledLaunchers || { setUser: function (u) { this.userData = u } };
NickelledLaunchers.userData = {
appId: "YOUR_NICKELLED_APP_ID",
userId: "YOUR_USER_ID"
}
var s = document.createElement("script");
s.async = true;
s.src = "https://cdn.nickelled.com/launchers-2.min.js";
var f = document.getElementsByTagName("script")[0];
f.parentNode.insertBefore(s, f);
})();
</script>

If you want to trigger the javascript without the userId, use the following:

<script type="text/javascript">
(function () {
var NickelledLaunchers = window.NickelledLaunchers = NickelledLaunchers || { setUser: function (u) { this.userData = u } };
NickelledLaunchers.userData = {
appId: "YOUR_NICKELLED_APP_ID"
}
var s = document.createElement("script");
s.async = true;
s.src = "https://cdn.nickelled.com/launchers-2.min.js";
var f = document.getElementsByTagName("script")[0];
f.parentNode.insertBefore(s, f);
})();
</script>

In both cases, ensure you have completed the Nickelled App ID, which is mandatory (neither snippet will work without it).

Did this answer your question?