Using Appcues on Anonymous Users

Typically Appcues flows are shown to users who are logged-in to your site, though there may be occasions when you'd like to target flows to anonymous visitors. 

You can use Appcues without user information for a public site or unidentified user in your app. To display messages based off of some behavior, you'll need to call Appcues.anonymous() in your installation.

The first thing you need to do is make sure you've installed Appcues on your site:

Installing Appcues for anonymous users

1. Add your Appcues embed script (or if you're installed via Segment skip this step).

Follow the installation instructions available in your account, which will look something like this:

<script src="//<your_id>.js"></script>

Next you need to tell us when the visitor is an unknown (i.e. not logged-in) user:

2. Use the Appcues.anonymous() call.

Use the Appcues.anonymous() function to tell us when an anonymous/unknown user has visited your site. Appcues will generate a unique ID for this visitor and store it in their web browser; then we'll check if there's content for which the visitor qualifies. When they qualify, the content is shown.  

If your app is a standard web-app with full page loads for each page, then you can call the function once per page, like so:

    <!-- ...Normal application HTML... -->
    <script type="text/javascript">

If your app is a "single-page app" (i.e. uses Backbone, Angular, Ember, etc) and doesn't trigger a page reload when the user navigates, then you'll want to call the function in the application router. For example, when using the ngRoute module of Angular, it might look something like this:

$rootScope.$on("$routeChangeSuccess", function(currentRoute, previousRoute){
    // Do whatever you'd normally do.

If you are installed via Segment, we recommend using  Segment's ready() call to ensure that Segment has loaded our script before trying call the Appcues.anonymous() function:


Using Appcues for anonymous and logged-in users

You may want to use Appcues content in an environment with anonymous visitors or on pages where your users are logged out, for example on a marketing site. Since anonymous users don't have ids, you cannot identify them with an Appcues.identify() call. Instead you can add the Appcues.anonymous() call to your embed script and target content to these unknown users. 

To use the Appcues.identify() and Appcues.anonymous() call together, you'll have to add conditional formatting to target both specific users  and all visitors. Here's what that code looks like:

if (userId) {
} else {

You can find installation instructions for the standard identify call   right here in your account or here in our docs right here

Important to Note:

This method of identifying anonymous users uses the browser's storage mechanism, which is not shared across devices. Because we do not have a an email address or user ID to identify the user across devices and browsers, they could see Appcues multiple times. People who use multiple devices or "incognito" browsers are pretty aware of this fact and usually don't mind seeing a duplicate message or two.

Be sure to only call either Appcues.identify() or Appcues.anonymous() on each page load. If both are called on the same page, the identity will switch between them and could cause the user to see the same content multiple times. 

Still need help? Contact Us Contact Us