Fan re-engagement for critical moments

Guided demo

Features described in this document are fully functional in the guided version of the Live Events demo, but not in the public Live Events demo. To see critical moment alerts in action, contact sales for a guided demo.

While real-time score alerts inform fans about events that have already occurred (like goals), critical moment alerts serve a different purpose: they notify fans about pivotal phases in the game as they're happening, driving immediate re-engagement at strategically important moments.

The Live Events demo implements notifications for injury time, creating urgency and a fear of missing out (FOMO) that compels fans to return to the app immediately.

By the end of this document, you will understand how to:

  • Implement critical moment alerts using PubNub's push notification system
  • Time notifications for maximum fan re-engagement
  • Craft compelling message content that drives immediate action

How PubNub helps

Role in the solutionPubNub feature (click to learn more!)
  • Send time-critical alerts to offline fans
  • Reach users on mobile devices
  • Drive immediate re-engagement
Mobile Push Notifications
  • Trigger notifications from server events
  • Format engagement-focused payloads
Pub/Sub Messaging
  • Set high notification priority
  • Create action-oriented alerts
FCM Integration

Use case overview

This document describes how PubNub enables sports apps to send timely alerts about critical moments in a game, specifically injury time, to drive fans back to the streaming app when the match outcome might be decided.

When the game enters injury time, the system sends push notifications informing fans that there are only five minutes remaining, creating urgency to return to the app to watch the conclusion of the match.

Key features include:

  • Timely alerts sent at strategic game moments
  • Urgency-focused messaging to drive immediate engagement
  • High-priority delivery to capture attention
  • Strategic timing for maximum impact on viewership
  • Action-oriented content to increase conversion
Cross-platform push notifications with PubNub

PubNub enables you to send push notifications to both Android and iOS devices with a single API call. This cross-platform capability eliminates the need to write platform-specific backend code or manage separate systems for different device types. Your server publishes one message, and PubNub handles the delivery to Firebase Cloud Messaging (FCM) for Android and Apple Push Notification service (APNs) for iOS devices.

The screenshots and examples in this documentation focus on Android (using FCM) as it can be demonstrated through web-based emulators, but the same PubNub implementation would deliver to iOS devices with minimal configuration changes.

While the self-led Live Events demo directs you to contact sales for a demonstration of push notifications, the following preview shows what you'll experience in the guided demo:

Push Notifications demo - injury time

During your guided demo with our sales team, they will show you how the game entering injury time will result in a push message being received on the Android emulator, informing fans that the game is in its crucial minutes (It's nearly all over for Southampton).

The push notification is displayed in two places:

  1. The web app (both tablet and mobile view) - this uses PubNub messaging to notify clients that a message has been sent

    Injury time notification - web

  2. The mobile emulator - this uses an actual mobile push message, sent through Firebase Cloud Messaging via PubNub, and displayed on an Android emulator running in the cloud

    Injury time notification - mobile

These previews demonstrate how PubNub's push notification capabilities deliver critical moment alerts to bring fans back to the action at pivotal points in the game.

icon

Under the hood

Basic setup for push notifications

The basic setup for critical moment alerts is identical to that of real-time score alerts, as both use the same underlying push notification infrastructure:

Server-side setup

// Initialize PubNub with push notification capabilities
const pubnub = new PubNub({
publishKey: process.env.PUBNUB_PUBLISH_KEY,
subscribeKey: process.env.PUBNUB_SUBSCRIBE_KEY,
userId: "game-server",
// Secret key is required on the server side for certain push operations
secretKey: process.env.PUBNUB_SECRET_KEY
});

Android client-side setup

// In MainActivity.kt
private fun initializePubNub(userId: String, subscribeKey: String) {
// Create PubNub configuration
this.pubnub = PubNub.create(
PNConfiguration.builder(
UserId(userId),
subscribeKey
).build()
)

// Register for push notifications
getToken() // Retrieve FCM token and register with PubNub
}

The difference between score alerts and critical moment alerts lies not in the setup, but in the timing, content, and strategic intent of the notifications.

icon

Required Admin Portal config


Backend implementation

The Live Events demo sends formatted push notification messages when the game enters injury time. These messages are designed to create urgency and drive immediate re-engagement.

Create notification payload

When injury time begins, the demo formats a push notification message with this structure:

{
channel: "game.push-sales",
data: {
text: 'PubNub Push Notification',
pn_fcm: {
data: {
title: 'Injury time',
body: "It's nearly all over for Southampton",
},
android: {
priority: 'high',
}
}
}
}

This message uses PubNub's FCM integration with these key elements:

  1. The channel parameter defines where the notification is published.
  2. The pn_fcm field contains the FCM-specific payload.
  3. title announces the critical phase of the game.
  4. body creates suspense with a dramatic statement that drives curiosity.
  5. priority: 'high' sets the priority as defined by FCM.

When this notification payload is published to the game.push-sales channel using PubNub's publish API, PubNub delivers it to all registered Android devices that have subscribed to that channel for push notifications - whether those devices are currently online or offline. The focus of this notification isn't to inform (as with score alerts) but to create emotional urgency that drives fans to immediately open the app.

Mobile client implementation

The mobile client in the Live Events demo uses the same Firebase Cloud Messaging (FCM) implementation to receive critical moment alerts as it does for score alerts. The infrastructure is identical, with the difference being in the notification content and timing.

Register device for push notifications

The device registration process is identical to that used for score alerts:

// In MainActivity.kt
private fun getToken() {
FirebaseMessaging.getInstance().token.addOnCompleteListener { task ->
try {
val token = task.result
if (token != null) {
Log.d(logTag, "Retrieved token: $token")
pubnub.addPushNotificationsOnChannels(
pushType = PNPushType.FCM,
deviceId = token,
channels = listOf(pushChannel) // "game.push-sales"
).async { result ->
result.onFailure { exception ->
Log.d(logTag, "Push Registration Failed: $exception")
}.onSuccess {
show all 28 lines

Both score alerts and critical moment alerts use the same channel ("game.push-sales") in this implementation, but in a production environment, you might use different channels for different notification types to allow users to opt in or out of specific categories.

Handle and display critical moment notifications

The FCMHandler processes and displays critical moment alerts using the same code as for score alerts, with the notification content determining how it appears to users:

// In FCMHandler.kt
private fun sendNotification(title: String, body: String) {
val notificationID = 101
// Just launch the app if the notification is tapped
val intent = Intent(this, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
}
val pend = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
val channelID = getString(R.string.default_notification_channel_id)

// Use trophy icon for all game notifications
val bm = BitmapFactory.decodeResource(resources, R.drawable.cup)

var builder = NotificationCompat.Builder(this, channelID)
.setSmallIcon(R.drawable.ic_launcher_foreground)
show all 27 lines

The critical moment notification appears with Injury time as the title and It's nearly all over for Southampton as the body, creating a sense of urgency that encourages fans to open the app immediately.

Timing considerations for maximum re-engagement

While the demo uses a simulation to trigger notifications, in a production environment, timing these alerts for maximum impact requires careful consideration:

  1. Strategic timing: Send alerts at truly pivotal moments (injury time, overtime, shootouts) when match outcomes are likely to be decided.
  2. Avoid notification fatigue: Limit critical moment alerts to 1-2 per game, reserving them for genuinely crucial phases. Both Android and iOS platforms can penalize your app if you send too many push notifications, as excessive notifications may be classified as spam. If your use case requires multiple notifications, consider varying the priority levels - use high priority (high for Android, higher numbers like 10 for APNs) only for the most critical moments, and normal priority for secondary alerts. This approach helps maintain user attention for truly important events.
  3. Personalization: Consider user behavior patterns—alert casual fans only about the most critical moments, while dedicated fans might want notifications about more game phases.
  4. Local time awareness: For international audiences, consider whether the alert is arriving at a time when the user can reasonably respond (e.g., not in the middle of the night).
  5. Buffer time: Send notifications about 30-60 seconds before the critical moment actually starts, giving fans time to open the app before missing anything important.

By implementing these timing considerations, sports apps can maximize the effectiveness of critical moment alerts, significantly increasing user re-engagement and viewership during the most important phases of a match.

Best practices for critical moment alerts

The guided, sales-led Live Events demo implements these best practices for effective critical moment notifications:

  1. Create urgency: The concise Injury time title immediately communicates a time-sensitive phase of the game.

  2. Spark curiosity: It's nearly all over for Southampton teases the viewers to open the app.

  3. Use strong visual cues: Appropriate icons stand out on the device.

  4. Direct call to action: The notification leads directly to the app when tapped.

  5. Strategic timing: Only send at truly pivotal moments when fans would regret missing the action.

  6. Emotional triggers: Appeal to fans' emotional investment in the outcome.

  7. Cross-platform support: For production apps, implement both FCM for Android and APNs for iOS to reach all users:

    pubnub.push.addChannels({
    channels: ["game.push-sales"],
    device: deviceToken,
    pushGateway: "apns2",
    environment: "production",
    topic: "com.your.bundle.id"
    });

By following these implementation patterns and best practices from the Live Events demo, sports applications can significantly increase fan engagement during critical game moments, bringing viewers back to the stream at exactly the right time to maximize viewership during the most important phases of a match.

Last updated on