Trigger Content Anonymously

Use case

Sometimes, it is helpful to trigger content on pages where users are logged out on a public website and during anonymous usage in your web app.

For such pages, the userpilot.identify() function is useless as your web app or site would have no way to send Userpilot any user data.


How to Trigger Content Anonymously

Just simply replace the userpilot.identify() function with the userpilot.anonymous() function as shown below.

<script> window.userpilotSettings = {token: "appToken"}; </script>
<script src = "https://js.userpilot.io/sdk/latest.js"></script>
<script> userpilot.anonymous(); </script>

When calling this method, Userpilot will automatically generate a user ID, the user will then be able to see the triggered content anonymously without the need to pass any user data.

Note: Any Userpilot content with the Audience setting set to "All users" will appear for the anonymous user.


Restrict content to only trigger for anonymous users

If you would like to show a certain Flow, Checklist, Spotlight, or Resource Center module to appear only for anonymous users, you can set the Audience condition to 'User Data' => 'user id' => doesn't exist

Users who access pages, where the Userpilot script is installed, will be counted as monthly active users – Userpilot tracks the numbers of unique users that login to the system in the previous 30 days. Thus, for a user to be counted towards your MAU, they will need to be first identified using userpilot.identify or userpilot.anonymous for being unique users that have logged into the product in the past 30 days.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.