Live Streaming

Deliver Personalized Content to Your Stream Audience

Darryn Campbell on Feb 16, 2025
Deliver Personalized Content to Your Stream Audience

In today's highly competitive streaming landscape, where consumer attention spans are shorter than ever, and content is abundant, capturing and retaining audience interest is a monumental challenge. For businesses offering live sports or media streams, being able to cut through the noise and connect with consumers on a deeply personal level has become essential.

Content personalization brings together multiple technologies to deliver rewards, experiences, and promotions that are tailored to the individual user. Traditional personalized experiences focused on predictable user patterns, for example, if they like a particular sports team, you could notify them that a stream containing their team is starting soon. Customer expectations are evolving, and the next step is being able to personalize content in real-time based on user behavior or what is happening on stream, for example, fans are more likely to buy merchandise if their team is winning a game, so adapt your monetization strategy as the game evolves and help the customer feel more engaged with the stream and their team.

Personalization works both ways. For consumers, it translates into a more relevant and enjoyable experience, reducing pain points, driving customer loyalty, and increasing viewer retention.

How can you make audiences feel more involved in your livestream? How can you deliver personalized content such as real-time game stats or quizzes tailored to what is happening on stream? PubNub is here to help optimize your solution for your target audience.

Delivering a Personalized Real-Time Experience to Your Audience

You can't run before you can walk, so although it might seem obvious, I like to break the process down into 3 steps:

Step 1: Gather data about your users and audience. Being open about what data you are collecting and why you are collecting it will build trust between you and your customers. The more data you can gather, the greater your understanding of your audience will be, eventually enabling you to deliver more relevant content.

Step 2: Build a profile for each user. This step is all about giving context and meaning to the data you have already gathered. A user's viewing data can determine their favorite team, whether they typically watch on their phone, and which country or region they're from. As a viewer interacts with your stream, you can discover their preferred language, their friends, and how passionate they are about the current live event.

Step 3: Take personalized actions in real-time. This has traditionally been the “hard bit”, but PubNub is changing that. Let's say we are dealing with a sports stream, and one team scores - this is impossible to predict ahead of time but is a great moment to send some personalized engagement: perhaps send a poll targeting a specific demographic of people, or send them a promotion for targeted merchandise to celebrate their team's predicted victory. You could even analyze the sentiment of chat messages within a stream, aggregate them using AI, and take action based on the emotion of the audience - even something as minor as showing a motivating animation to a disheartened user will help them feel engaged.

3 Steps for personalizing real-time experiences

Step 1: Gather Data on User Behavior

Every action your users take is data useful in understanding your audience. This is not a new concept, and you are already familiar with big data and predictive analytics solutions that can help you analyse your customer behavior “after the fact,” determine better what you should do “next time,” and create email marketing campaigns.

As we start to think about content delivery and how to take real-time personalized actions for each user, it is useful to think of user behavior in two different ways:

  1. Actions a user takes that help us learn more about that user and predict what they will do next time. This is the traditional “you might be interested in these live streams” approach that services, such as Netflix or Spotify, offer, and the more data users let you collect, the more personalized you can make content or product recommendations.

  2. Actions a user is taking right now: For example, are they online or offline? Which chat groups are they participating in? Are they happy or sad? Are they reacting to your stream? All of this customer data is critical to understand the type of personalized engagement that will resonate with them: It is the difference between sending an offline user a mobile notification that their favorite team is playing soon, and incentivizing an online user to participate in your live stream chat.

Using PubNub, let's say you want to detect when a user goes online or offline, we refer to this as User Presence and it lets you know where your users are, and which streams they are currently watching in just a few lines of code. The most common platforms your users will be engaging with your streams are the web, either on mobile or desktop and native mobile apps for Android or iOS. With 50+ SDKs, PubNub has your platform covered, but let's look at the code you would use to detect when a user goes online or offline for those 3 platforms mentioned

Users will subscribe to a channel which represents the stream chat they are currently a member of, let's say the channel name is football-stream

JavaScript: Subscribing to a channel with presence

Kotlin (Android): Subscribing to a channel with presence

Swift (iOS): Subscribing to a channel with presence

Step 2: Build a Profile for Each User

With data gathering in place, the next step is to build a profile for each user based on data-driven insights, which will, of course, update and improve the more that user interacts with your application and streams.

Where should you store your user profiles? As mentioned in the first step, there are two types of data you want to keep track of: “traditional analytics” and “real-time actionable events”. You probably already have a platform in place for analytics and the great news is you can continue using your current platform AND still take advantage of real-time events generated by your users and captured through PubNub. PubNub's Events & Actions platform allows you to select and filter events as they pass through the PubNub network, with matching events being forwarded to either Amazon Kinesis, Apache Kafka, or a custom webhook allowing support for any platform. We also support bidirectional communication with Kafka using our PubNub Kafka Bridge.

But what about profile data that is needed to make real-time decisions immediately? For example, a user's current mood, or their current level of engagement with your stream? PubNub AppContext should be used to store information about your users and stream content, this might be:

  • The fan profile - their favourite team, whether they are currently typing a message, or their current mood. Fans, or stream participants are referred to as Users within PubNub AppContext.

  • The streams - which teams are playing, who is winning, or which artist is performing and which stage are they on. Streams are referred to as Channels within PubNub AppContext.

  • The relationship between fans and streams—who is watching which stream, or which group of viewers has been watching the longest? PubNub AppContext captures these relationships as Memberships.

As an example of what you could do, let's take the following scenario to analyze user sentiment:

  1. A user is chatting and interacting with other users whilst watching one of your live streams.

  2. The user's messages are analysed in real-time to determine their sentiment - is this fan excited or disheartened at their team's performance?

  3. The AppContext for this user is updated with their current 'mood'

This interaction would be trivial to implement using PubNub as follows:

Analyzing user sentiment (1): A user is chatting and interacting with other users in your live stream

PubNub was designed to send and receive messages at scale, we are the world's largest event-driven network with less than 30ms global latency and an industry-leading 99.999% uptime. To help you build your chat solution, we have SDKs covering all popular languages, including dedicated Chat SDKs for JavaScript, Kotlin (Android), and Swift (iOS) making it trivial to incorporate chat alongside your streaming application.

Using our Chat SDKs, you can quickly build a solution that features:

  • Send and receive messages at scale, so participants can communicate regardless of how many people are watching the stream.

  • Live reactions, so fans can react immediately to what is happening on-stream as well as react to others' messages.

  • Moderation, allowing a safe and inclusive environment.

Everything that passes through our network is secure and compliant, we support message encryption, and we are certified for SOC2, GDPR, CCPA, and ISO27001

Analyzing user sentiment (2): The user's messages are analyzed in real-time to determine their sentiment

PubNub exposes serverless Functions, allowing you to add custom logic as messages pass through our network. These Functions also support pre-built custom integrations with third-party services and APIs, including artificial intelligence or machine learning algorithms.

So, for example, if you wanted to analyze a user's message sentiment in real time, your solution would look as follows:

  • User sends a chat message

  • PubNub function detects that a message was sent and runs code asynchronously (we refer to this as an 'after publish' function, because it runs after the message is published to recipients)

  • A REST API call is made to an external service to analyse the message's sentiment, we support machine learning solutions (e.g. HuggingFace), AI-powered automation (e.g. OpenAI), or dedicated content analysis solutions (e.g. Tisane Labs).

  • The result of the REST API call can be stored as part of the user's profile.

The workflow would look something like this as a diagram. Of course, this is just an example of architecture, and Functions are very flexible.

Analysing user message sentiment

To learn more about how PubNub Functions can be used for sentiment analysis, including example code, please check out my recent blog, “Two reasons why PubNub Functions are Awesome”, where I covered this in more detail.

Analyzing user sentiment (3): The AppContext for this user is updated with their current 'mood'

To extend the previous example, once the user's message sentiment has been determined you can store this in AppContext. The Function execution environment exposes a PubNub module that can save data to and retrieve data from AppContext.

Step 3: Take Personalized Actions in Real-Time

At this stage, you have a process in place to gather data about your stream viewers and are using that data to create and update their user profiles in real time. Let's look at some of the actions you can take to deliver highly personalized content, such as promotions or rewards that give tailored experiences based on fans’ behavior and preferences.

  • If a user is offline, you could send them a mobile notification when a stream featuring their favorite sports team or music artist is about to start. Online fans would not receive this message.

  • You can enrich the streaming chat of live sports by adding polls or live commentary. Since sports are inherently unpredictable, you want to trigger a relevant poll only at the right moment during play.

  • You could alert the user immediately when their favorite team scores or a player is substituted.

  • As real money gaming odds update, you could notify interested users when odds are particularly good for teams they regularly bet on - since every second counts when talking about gaming odds, PubNub's <30ms latency is critical.

PubNub Illuminate is a powerful tool that lets you respond to events within the stream in real-time, and take actions based on both those events & the user's current profile.

To extend the previous example, where we determined the user's current mood, let's assume the following:

  • The user, named Troy, is watching a live-streamed basketball game between the “Wildcats” and the “Knights”.

  • Troy supports the Wildcats, and as he watches the game, he sends messages using the stream chat. Based on the content of these messages, his 'mood' is assigned a numeric value as described in the previous step.

  • Troy's mood will be tracked in PubNub AppContext as part of his User metadata

  • The current game score will be tracked in PubNub AppContext as part of the Channel metadata

The scenario is as follows: You want to run a promotion targeted at Wildcats fans. Specifically, if the team is dominating its rivals, you want to offer any high-spirited users who are in a good mood an opportunity to celebrate by buying some themed merchandise.

Using PubNub Illuminate, you could set up a “Business Object” as follows:

PubNub Illuminate Business Object

“Business Objects” define what you want to track, specifically I have defined the user's mood, their favorite team and the current team scores. Notice that the user's mood and favorite team are mapped to $.user.custom.mood and $.user.custom.favorite_team, so are pulled from User AppContext. Similarly, the Wildcats team score is pulled from Channel AppContext, $.channel.custom.wildcatsScore

The Business Object will monitor these data fields, calculate any metrics, determine whether any decisions need to be evaluated, and present the data on any defined Dashboards.

The metric will calculate the average mood of Wildcat fans as they send chat messages.

PubNub Illuminate Metric

Notice the filter to only evaluate this metric for Wildcats fans, remember the favorite team is stored in PubNub AppContext and forms part of our user profile. If new users join the stream, and declare themselves Wildcats fans (or you infer it from their behavior and update their profile automatically), then they will automatically be included in this metric. Filters can also allow a degree of A/B testing, breaking down viewers into audience segments to test customer engagement.

The metric will be evaluated whenever a user sends a message, so it is the mood of actively participating chat users, weighted towards those users sending more messages.

PubNub Illuminate Dashboard

The dashboard will display that average user mood, updating in real-time, so you can visualize your audience's mood as the live stream progresses.

The red bars on the graph indicate whenever a 'Decision' was made, so let’s look at that:

PubNub Illuminate Decision

Remember, the goal is to send spirited users who are in a good mood a merchandise promotion if their team is outperforming their rivals.

The decision defines the scenario we want to capture, in this case, we detect whether the user is a Wildcat fan and the Wildcats have scored over 90 points, whilst their rivals are languishing below 60. The user's mood must also be greater than '10' - remember this is an arbitrary value we have assigned based on the sentiment of the user's messages they are sending in the stream chat.

If all the conditions in the decision evaluate to true, then the “Send Happy User Promotion” action is performed.

For testing, I am sending a PubNub Message back to the user on the same channel used for chat, game01 in this case.

PubNub Illuminate Action

Testing using the PubNub debug console (part of the admin portal), and having previously defined the user's mood and team score using AppContext, the action can be successfully triggered:

PubNub Illuminate - Testing with Send Message

In production, instead of sending a test message, you would expose a custom webhook in your server application, which would be called by PubNub Illuminate whenever a user needs to be sent a promotion. As you can see from the test message, the user ID, their mood score and their favorite team have been included which should be enough detail to email the user a promotion link, but Illuminate is very flexible and any data fields you define in your “Business Object” can also be included in the webhook.

Create a Digital Marketing Strategy

How can personalized marketing improve customer satisfaction? By using a combination of dynamic content, customer preferences, and personalization strategies, you can develop social media campaigns, email campaigns, and landing pages/homepages tailored to a specific audience. This is the power of personalization; by taking a user’s individual preferences and past purchases into account with real-time actions, you can enhance their customer experience. Understand potential customers better by looking at the specific needs of your current customers and considering their customer journey: what is their purchase history? Or browsing history on your site? Let user data collection inform your content marketing: What delivers the most engaging experience for your customer? Which calls to action give the best click-through rates and drive higher engagement? Rather than wait until after the event concludes, you can now get valuable insights into the user experience in real time and adjust your content strategy accordingly.

In Conclusion

By personalizing your streaming content for individual customers and making the experience interactive for your viewers, you can increase viewer retention and conversion rates, boost brand loyalty, and increase market share. By making user interactions real-time, you can take advantage of opportunities for monetization that you could not have foreseen prior to the sports event or media stream starting.

Learn more about PubNub can help with your live sports, streaming & fan engagement solution; get in touch, or sign up for a free PubNub account to explore how you can tailor content for your audience in real-time.