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 identification' => 'user id' => Is not known

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