Sending Events (Developer)

This article is intended for developers implementing Appcues. See the Events Overview for a higher level explanation.

Recommended events

See the Events Overview for recommendations. If you're installing Appcues for someone else, make sure to ask them what events they need. 

Tracking events

If you haven't installed Appcues yet, tracking events is covered in the Installation Guide (Developer) and you should start there. You can also visit the "Properties and Events" step in the Appcues installation guide to get snippets for calling appcues.track() to track events tailored to your front-end stack (if you don't have access to this page, ask someone on your team to invite you to the Appcues account). The snippet for tracking events will look something like the following: 

Appcues.track("Event Name"); // e.g. "Clicked Some Button"

Appcues.track("Another Event", { // e.g. "Submitted a Help Ticket"
  url: "/support",
  article:"installation"
)};

How to track events

If you're using Appcues through our Segment integration, use the analytics.track() function to track events. The events you track will then be available to Appcues and the other services you've integrated with.

If you are using Appcues outside of Segment, you can use the Appcues.track() function, which works just like analytics.track() but only sends events to the Appcues API.

The examples below will use Appcues.track().

Tracking an example event

Let's consider an auction site that wishes to show a message of congratulations after a user creates their first auction.

The site developer may add a line of code to their application that looks like this:

Appcues.track("Created auction");

The time at which the event occurred, as well as information about the user who experienced the event, is automatically recorded, so don't worry about putting this in yourself.

Tips

Ensure Appcues.identify() or Appcues.anonymous() (or the analytics.js equivalent) has been called before tracking events.

A user ID, whether identified or anonymous, is required to record event data, so make sure any calls to track() come after a call to identify() or anonymous().

Don't put too much detail into event names.

You want to be able to group similar events by name, so rather than:

Appcues.track("Added item ID=12345 to shopping cart");

Do this:

Appcues.track("Added item to shopping cart", {item_id: 12345});

Targeting based on event attribute values may be added in a future version of Appcues. Event attributes are also useful for examining data on dedicated analytics platforms like Amplitude or Mixpanel.