Accessing the REST API

  1. Identify the correct API key to use. You can find this on the Project Settings page after you log in. Each API Key corresponds to a collection of events belonging to a specific project. If you want to track events for multiple projects (say, two completely unrelated apps), you should use a different API Key for each one. We also recommend that you create a “Testing” project and use that API Key in your development environment. Avoid sharing your API Keys among different projects so that data flows into the correct area from your application or website.
  2. Add a call tagging an event. Once you’ve identified a location in your code that represents an occurrence of an event, you’ll drop in a single line specifying that event’s name.
  3. Provide a unique user identifier for the event. In many cases you’ll want to see just the number of unique users who performed an action, rather than the total number of actions that occurred. To make that kind of analysis possible, we’ll need you to provide a unique identifier for the user performing each action. The exact format of this identifier is up to you, as long as it’s consistent for each user across multiple events.
  4. Add property data to the event. Next, you’ll add name-value pairs of properties, our term for contextual metadata about an event or the user associated with it. This requires indicating which specific properties you want to be recorded every time this event occurs.
  5. Send us the event! With the above steps completed, you’re all set to send the event our way. This can be accomplished through a simple HTTP POST to our REST API, or using one of the handy methods provided in our packaged clients.
2 users found this helpful