Implementation Best Practices

Naming Events and Properties

  • Make your event names simple and intuitive. If you find yourself about to assign a long, complex name to an event, think about whether there’s a better way to record that data. For example, rather than having two events named “One-Month Subscription Purchase” and “Six-Month Subscription Purchase”, you could have one “Subscription Purchase” event tagged with a “Billing Term” property value.
  • As in the above example, event and property names can contain spaces and punctuation marks. Take advantage of that feature to make your event and property names more easily readable.
  • Be sure to name properties consistently across events. If you interchangeably record a property name as either “Color” or “Colour”, those will be treated as two separate properties, making it much more difficult to accurately segment your data.

 

Adding New Events

  • Before you tag an event somewhere in your code, make sure you fully understand the implications of choosing that particular spot. Remember that the event will be recorded every time that block of code is executed. The overwhelming majority of data consistency issues come from incorrect assumptions about your own code.
  • Create a project for testing purposes, and make good use of it. To create a new project, click on the name of your current project in the navigation bar at the top of the screen, and click “New Project”. Use the new API Key associated with this project in your development environment to ensure that your test data remains separate from your production data. Before deploying to production, test each new event in your development environment and verify that your test project is correctly receiving the data.

 

Adding Properties

  • There will likely be certain properties that you want to be recorded for every event. To accomplish this, we recommend modifying our existing clients. Add a method that takes as an argument the Object representation of one of your users. In the body of this method, add to the event’s properties map any properties you want to be recorded for every event. This will allow you to conveniently record a group of properties using a single method call.

 

Unique User Identifiers

  • Each user of your app should have a unique, persistent identifier associated with them. Setting this unique ID each time you record an event will let you dig deeper into your data, allowing for funnel and cohort analysis as well as unique counts in the segmentation tool.
0 users found this helpful