Anonymous Users (Developer)

Installing Appcues for anonymous users 

You can target users on a public site or during anonymous usage in your application using Appcues.anonymous() instead of Appcues.identify() .

A word of warning  

We advise against installing Appcues on public pages or tracking users anonymously in your application. Appcues is powerful because it has the ability to show content to the right users at the right time -- and you need to know who your users are in order to do so. You can use the  Appcues.identify() call described in the Installation Guide to identify users. 

Billing and anonymous users 

Appcues bases your billing on the monthly active users (MAUs) in your application. If you install using Appcues.anonymous(), each user will be counted for each new session and could cause users to be counted multiple times toward your MAU limit. This can compound on public pages, since they generally have higher traffic than logged-in pages, and can greatly increase the cost of using Appcues. Learn more about billing. 

How to install with anonymous users  

If you do install Appcues on a public-facing page or during anonymous usage, replace the Appcues.identify() call with an Appcues.anonymous() call. 

You will use the Appcues.anonymous() method 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:

<body>
    <!-- ...Normal application HTML... -->
    <script type="text/javascript">
        Appcues.anonymous();
    </script>
</body>

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.
    Appcues.anonymous();
});

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:

analytics.ready(function(){
    Appcues.anonymous();
});

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

if (userId) {
    Appcues.identify(userId);
} else {
    Appcues.anonymous();
}

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. 

Need help identifying users? 

We highly recommend using  Appcues.identify() and avoiding anonymous users all together. If you are having trouble with installation please reach out to our team at support@appcues.com and we can help you install just right!