What are Events?
Events represent individual user interactions against Metrics in Trophy. One event corresponds to a single interaction made by a single user. When you integrate metrics into your platform, you’re setting up your platform to continuously stream events to your Trophy metrics for each user interaction. These interactions then drive all the gamification features you set up around these metrics.Key Attributes
Events only have one required attribute,value
. The value of an event is the numerical amount that will be added to the user’s total metric count as a result of the user interaction it relates to.
The value can be positive or negative, and can be a whole number or a decimal.
Custom Event Attributes

Creating Attibutes
To create a new custom event attribute, head to the metrics page in the Trophy dashboard and hit the Add Event Attribute button. Give the attribute a name and a unique key, you’ll use the key when referencing the attribute in API calls.Setting Attributes
To set the value of a custom attribute on an event, pass its value in theattributes
object in your metric tracking code.
Trophy will only set values of attributes that have first been created
in the dashboard. We do this to help you keep a clean set of attributes and
prevent accidental overwrites.If you receive an error similar to the following then you might have miss-spelled the attribute key in the request, or you need to create the attribute first in the Trophy dashboard:
device
and duration
, are set:
Using Attributes
Custom event attributes can be used to power more advanced triggers for achievements and points and can be used in email templates to customize copy and to control the data shown in charts.Advanced Feature Triggers
Custom event attributes can be used to set up achievements or points triggers that only track events with specific attribute values. Follow the links to the relevant pages below to learn more.Achievement Triggers
Configure achievements that can only be unlocked by events with certain
attribute values.
Points Triggers
Set up points triggers to only award points from events with specific
attribute values.
Email Customization
If you use any Trophy Emails, event attributes can be used to customize the data shown in certain email blocks. Firstly, when using metric-based variables in email copy you can use event attributes to further control what data the variable refrences. For example here’s a case where we use an email variable to tell users what their total number of workouts they’ve done on different gym equipment is using a metric ‘Workouts’ and an attribute ‘Equipment’:Tracking Metric Events
Each metric has a uniquekey
which you can use to reference and track events against it in your code. You can find the key
in the metric settings page.
To start tracking user interactions as events against your Trophy metrics, use the Metrics API or one of our type-safe Client SDKs supported in most major programming languages.
Here’s an example where a fictional book-writing platform is using a metric to track the number of words written by each author. Each time an author edits their book, the platform sends an event to Trophy telling it how many words they wrote:
Response
- Newly unlocked achievements as a result of the event
- The users latest streak as result of the event
- Any points awards as a result of the event
- Triggering in-app notifications
- Sound effects
- Animations
Idempotent Events
Trophy supports enforcing uniqueness on events so that users cannot increase a metric by taking the same exact action over and over. For example, a language learning app could specify that users can only increase thelessons completed
metric by 1 for each unique lesson completed, so if they complete the same lesson twice only the first counts.
This helps keep your codebase free of logic that checks if users have completed actions before, and can instead trust Trophy to uphold the constraints you need.
To use idempotent events, use the Idempotency-Key
header in the metric event API.
Learn more about idempotency.