The user experience implemented by an app on receipt of a Trigger payload may not always be relevant to the user, it may be that it doesn't fall in line with a user's preferences or that they have already triggered that user experience in the app and it is not relevant to them again.
It's important in situations like this that the user does not perceive the experience as spam as this could adversely affect their perception of the app.
In order to help app developers create a strategy to avoid this perception of spam the TapPoint SDK reports to apps how many times a payload has been reported to an app over the last seven days, the statistics reported are:
Field | Description |
Last Event Timestamp | The last time an event involving a trigger with this payload was reported to the application. |
Events In The Last Hour | The number of events reported to the application involving triggers with this payload in the last 60 minutes. |
Events In The Last Day | The number of events reported to the application involving triggers with this payload in the last 24 hours. |
Events In The Last Week | The number of events reported to the application involving triggers with this payload in the last 7 days. |
Below is an example of how these statistics are reported to an app as a user interacts with Triggers.
Monday 09:04 a user interacts with a Trigger for the first time on their way to work.
Last Event Timestamp: Nil/Null.
Events in the last hour: 1.
Events in the Last Day: 1.
Events in the last Week: 1.
Monday 17:15 the same user interacts with a Trigger with the same payload.
Last Event Timestamp: Today 09:04.
Events in the last hour: 1.
Events in the Last Day: 2.
Events in the last Week: 2.
Tuesday 10:13 the same user interacts with a Trigger with the same payload.
Last Event Timestamp: Yesterday 17:15.
Events in the last hour: 1.
Events in the Last Day: 2.
Events in the last Week: 3.
The rate statistics are accessible on the Trigger object provided by the TapPoint SDK whenever a trigger occurs.
iOS Trigger Object - Rate Statistics Property
Android Trigger Object - Rate Statistics Property
By using the rate statistics provided by the TapPoint SDK developers can enforce rules within their app to ensure that the user experience is not perceived as spam.
As an example the following code snippets enforce a rule to ensure that a user experience is only triggered once per calendar day.
public void processDetectedTrigger(Trigger trigger) {
if (shouldTriggerUserExperience(trigger.rateStats())) {
// Go ahead and trigger the user experience.
}
else {
// Our rate limit rule prevents us from triggering the user experience.
}
}
public boolean shouldTriggerUserExperience(TriggerRateStats rateStats) {
// We allow the UX if we haven't triggered it in the last 24 hours...
// and haven't exceeded more than five times this week.
shouldTriggerUX = ((rateStats.getEventsInTheLastDay() == 1) && (rateStats.getEventsInTheLastWeek() < 5));
return shouldTriggerUX;
}
- (void)processDetectedTrigger:(NSNotification *)notification
{
NSLog(@"TapPoint Triggers Detected!");
PRXTrigger *trigger = [notification.userInfo objectForKey:PRXDetectedTriggerNotificationKeyForTrigger];
if ([self shouldTriggerUserExperience:trigger.rateStatistics]) {
// Go ahead and trigger the user experience.
}
else {
// Our rate limit rule prevents us from triggering the user experience.
}
}
(BOOL)shouldTriggerUserExperience:(PRXTriggerRateStatistics *)rateStats
{
// We allow the UX if we haven't triggered it in the last 24 hours...
// and haven't exceeded more than five times this week.
BOOL shouldTriggerUX = ((rateStats.eventsInTheLastDay == 1) && (rateStats.eventsInTheLastWeek < 5));
return shouldTriggerUX;
}