Skip to main content

Sentiment Analysis

AI-powered sentiment analysis detects the emotional tone of user messages, enabling tone-matched advertising and appropriate creative selection.

Overview

Sentiment analysis classifies the emotional tone of user interactions into positive, neutral, or negative categories with a confidence score. This enables bidders to match ad tone to user emotional state for better engagement.

Sentiment Object Structure

{
"sentiment": {
"value": "positive",
"score": 0.8
}
}

Field Reference

FieldTypeRequiredDescriptionExample
valueenumYes"positive", "neutral", or "negative""positive"
scorenumberYesSentiment score 0.0-1.00.8

Sentiment Values

positive

User expresses positive emotions, enthusiasm, or satisfaction.

Indicators:

  • Excited language
  • Positive words (great, love, amazing)
  • Enthusiastic punctuation (!)
  • Expressions of satisfaction

Score Range: 0.6 - 1.0

Example:

{
"value": "positive",
"score": 0.85
}

Use Cases:

  • Upbeat, energetic creatives
  • Celebration-themed ads
  • Premium offerings
  • Aspirational messaging

Example Messages:

  • "This sounds amazing!"
  • "I love this idea!"
  • "Perfect, exactly what I need!"

neutral

User expresses neutral tone without strong emotional signals.

Indicators:

  • Factual questions
  • Informational requests
  • Objective language
  • No emotional markers

Score Range: 0.4 - 0.6

Example:

{
"value": "neutral",
"score": 0.5
}

Use Cases:

  • Informational creatives
  • Straightforward messaging
  • Feature-focused ads
  • Educational content

Example Messages:

  • "What are the options?"
  • "Tell me about the features"
  • "How does this work?"

negative

User expresses negative emotions, frustration, or dissatisfaction.

Indicators:

  • Frustrated language
  • Negative words (bad, hate, terrible)
  • Problem descriptions
  • Complaints

Score Range: 0.0 - 0.4

Example:

{
"value": "negative",
"score": 0.3
}

Use Cases:

  • Solution-oriented creatives
  • Empathetic messaging
  • Problem-solving ads
  • Support services

Example Messages:

  • "This is frustrating"
  • "I'm having trouble with..."
  • "This doesn't work"

Sentiment Score

The sentiment score provides a continuous measure of emotional intensity.

Range: 0.0 to 1.0

Interpretation:

  • 0.8 - 1.0: Very positive
  • 0.6 - 0.8: Moderately positive
  • 0.4 - 0.6: Neutral
  • 0.2 - 0.4: Moderately negative
  • 0.0 - 0.2: Very negative

Example:

{
"score": 0.85
}

Complete Examples

Example 1: Positive Sentiment

User excited about vacation planning:

{
"ext": {
"aura": {
"messageSequenceNumber": 3,
"messageLength": 42,
"intent": {
"value": "purchase_inquiry",
"confidence": 0.92,
"topics": ["vacation", "beach resort"],
"signals": ["expressed_excitement", "ready_to_purchase"]
},
"sentiment": {
"value": "positive",
"score": 0.9
}
}
}
}

Recommended Creative Approach:

  • Upbeat, energetic tone
  • Celebration imagery
  • Exciting language
  • Premium positioning

Example 2: Neutral Sentiment

User researching options:

{
"ext": {
"aura": {
"messageSequenceNumber": 2,
"messageLength": 35,
"intent": {
"value": "information_seeking",
"confidence": 0.88,
"topics": ["golf equipment", "pricing"],
"signals": ["comparison_shopping"]
},
"sentiment": {
"value": "neutral",
"score": 0.5
}
}
}
}

Recommended Creative Approach:

  • Informational tone
  • Feature highlights
  • Comparison charts
  • Objective messaging

Example 3: Negative Sentiment

User frustrated with booking issue:

{
"ext": {
"aura": {
"messageSequenceNumber": 4,
"messageLength": 58,
"intent": {
"value": "support_request",
"confidence": 0.9,
"topics": ["booking problem", "cancellation"],
"signals": ["expressed_frustration", "needs_assistance"]
},
"sentiment": {
"value": "negative",
"score": 0.3
}
}
}
}

Recommended Creative Approach:

  • Empathetic tone
  • Solution-focused
  • Support services
  • Reassuring messaging

Publisher Implementation

Sentiment Detection

class SentimentAnalyzer {
async analyzeSentiment(message) {
// Use AI/ML model for sentiment classification
const classification = await this.classifyMessage(message)

return {
value: this.getSentimentValue(classification.score),
score: classification.score,
}
}

getSentimentValue(score) {
if (score >= 0.6) return 'positive'
if (score <= 0.4) return 'negative'
return 'neutral'
}

// Simple rule-based fallback
analyzeSimple(message) {
const text = message.toLowerCase()
let score = 0.5 // Start neutral

// Positive indicators
const positiveWords = ['great', 'love', 'amazing', 'perfect', 'excellent']
positiveWords.forEach(word => {
if (text.includes(word)) score += 0.1
})

// Negative indicators
const negativeWords = ['bad', 'hate', 'terrible', 'frustrated', 'problem']
negativeWords.forEach(word => {
if (text.includes(word)) score -= 0.1
})

// Clamp to 0-1 range
score = Math.max(0, Math.min(1, score))

return {
value: this.getSentimentValue(score),
score: score,
}
}
}

Usage Example

const analyzer = new SentimentAnalyzer()

// Positive example
const sentiment1 = await analyzer.analyzeSentiment('This looks amazing!')
// { value: 'positive', score: 0.9 }

// Neutral example
const sentiment2 = await analyzer.analyzeSentiment('What are the options?')
// { value: 'neutral', score: 0.5 }

// Negative example
const sentiment3 = await analyzer.analyzeSentiment('This is frustrating')
// { value: 'negative', score: 0.3 }

Bidder Implementation

Sentiment-Based Creative Selection

function selectCreative(sentiment, creatives) {
// Filter creatives by sentiment match
const matchingCreatives = creatives.filter(creative => {
if (sentiment.value === 'positive') {
return creative.tone === 'upbeat' || creative.tone === 'energetic'
} else if (sentiment.value === 'negative') {
return creative.tone === 'empathetic' || creative.tone === 'supportive'
} else {
return creative.tone === 'neutral' || creative.tone === 'informational'
}
})

return matchingCreatives[0] || creatives[0]
}

Bid Adjustment

function adjustBidForSentiment(basePrice, sentiment, intent) {
let modifier = 1.0

// Positive sentiment + purchase intent = higher value
if (sentiment.value === 'positive' && intent.value === 'purchase_inquiry') {
modifier = 1.3
}

// Negative sentiment = lower bid or skip
if (sentiment.value === 'negative') {
modifier = 0.7
}

// Very positive sentiment = premium
if (sentiment.score > 0.8) {
modifier *= 1.2
}

return basePrice * modifier
}

Tone Matching

function matchTone(sentiment) {
const toneMap = {
positive: {
high: ['celebratory', 'energetic', 'exciting'],
medium: ['upbeat', 'friendly', 'warm'],
},
neutral: {
high: ['informational', 'professional', 'clear'],
medium: ['straightforward', 'factual', 'objective'],
},
negative: {
high: ['empathetic', 'supportive', 'understanding'],
medium: ['solution-focused', 'helpful', 'reassuring'],
},
}

const intensity =
sentiment.score > 0.7 || sentiment.score < 0.3 ? 'high' : 'medium'
return toneMap[sentiment.value][intensity]
}

Sentiment + Intent Combinations

High-Value Combinations

SentimentIntentStrategy
Positivepurchase_inquiryPremium pricing, aspirational ads
Positiveinformation_seekingEngaging educational content
NeutralcomparisonFeature comparison, objective
Negativesupport_requestEmpathetic support services

Example: Positive + Purchase Intent

{
"intent": {
"value": "purchase_inquiry",
"confidence": 0.92,
"topics": ["luxury resort"],
"signals": ["ready_to_purchase", "expressed_excitement"]
},
"sentiment": {
"value": "positive",
"score": 0.9
}
}

Strategy:

  • Show premium offerings
  • Use aspirational imagery
  • Emphasize exclusivity
  • Higher bids

Example: Negative + Support Request

{
"intent": {
"value": "support_request",
"confidence": 0.88,
"topics": ["booking issue"],
"signals": ["expressed_frustration", "needs_assistance"]
},
"sentiment": {
"value": "negative",
"score": 0.3
}
}

Strategy:

  • Show support services
  • Use empathetic tone
  • Emphasize solutions
  • Lower bids or skip

Best Practices

1. Match Creative Tone

Always match creative tone to sentiment:

function shouldShowCreative(creative, sentiment) {
if (sentiment.value === 'negative' && creative.tone === 'celebratory') {
return false // Tone mismatch
}
return true
}

2. Combine with Intent

Use sentiment + intent together:

function calculateValue(sentiment, intent) {
const baseValue = getIntentValue(intent)
const sentimentModifier = getSentimentModifier(sentiment)
return baseValue * sentimentModifier
}

3. Handle Edge Cases

Be careful with extreme sentiments:

function shouldBid(sentiment) {
// Skip very negative sentiment
if (sentiment.score < 0.2) {
return false
}
return true
}

4. Use Score Granularity

Use the score for fine-grained decisions:

function getCreativeIntensity(sentiment) {
if (sentiment.score > 0.8) return 'high'
if (sentiment.score > 0.6) return 'medium'
if (sentiment.score > 0.4) return 'low'
if (sentiment.score > 0.2) return 'medium'
return 'high' // Negative
}

Privacy Considerations

Sentiment analysis is privacy-safe:

  • No PII: Only analyzes message content
  • Contextual: Based on current conversation
  • Aggregated: No long-term tracking
  • Transparent: Users understand context is analyzed

Next Steps