In the media and entertainment industry, understanding and predicting the effectiveness of marketing campaigns is crucial for success. Marketing campaigns are the driving force behind successful businesses, playing a pivotal role in attracting new customers, retaining existing ones, and ultimately boosting revenue. However, launching a campaign isn’t enough; to maximize their impact and help achieve a favorable return on investment, it’s important to understand how these initiatives perform.

This post explores an innovative end-to-end solution and approach that uses the power of generative AI and large language models (LLMs) to transform marketing intelligence. We use Amazon Bedrock, a fully managed service that provides access to leading foundation models (FMs) through a unified API, to demonstrate how to build and deploy this marketing intelligence solution. By combining sentiment analysis from social media data with AI-driven content generation and campaign effectiveness prediction, businesses can make data-driven decisions that optimize their marketing efforts and drive better results.

The challenge

Marketing teams in the media and entertainment sector face several challenges:

  • Accurately gauging public sentiment towards their brand, products, or campaigns
  • Creating compelling, targeted content for various marketing channels
  • Predicting the effectiveness of marketing campaigns before execution
  • Reducing marketing costs while maximizing impact

To address these challenges, we explore a solution that harnesses the power of generative AI and LLMs. Our solution integrates sentiment analysis, content generation, and campaign effectiveness prediction into a unified architecture, allowing for more informed marketing decisions.

Solution overview

The following diagram illustrates the logical data flow for our solution by using sentiment analysis and content generation to enhance marketing strategies.

Elevate marketing intelligence with Amazon Bedrock and LLMs for content creation, sentiment analysis, and campaign performance evaluation

In this pattern, social media data flows through a streamlined data ingestion and processing pipeline for real-time handling. At its core, the system uses Amazon Bedrock LLMs to perform three key AI functions:

  • Analyzing the sentiment of social media content
  • Generating tailored content based on the insights obtained
  • Evaluating campaign effectiveness

The processed data is stored in databases or data warehouses, then made available for reporting through interactive dashboards and generated detailed performance reports, enabling businesses to visualize trends and extract meaningful insights about their social media performance using customizable metrics and KPIs. This pattern creates a comprehensive solution that transforms raw social media data into actionable business intelligence (BI) through advanced AI capabilities. By integrating LLMs such as Anthropic’s Claude 3.5 Sonnet, Amazon Nova Pro, and Meta Llama 3.2 3B Instruct Amazon Bedrock, the system provides tailored marketing content that adds business value.

The following is a breakdown of each step in this solution.

Prerequisites

This solution requires you to have an AWS account with the appropriate permissions.

Ingest social media data

The first step involves collecting social media data that is relevant to your marketing campaign, for example from platforms such as Bluesky:

  1. Define hashtags and keywords to track hashtags related to your brand, product, or campaign.
  2. Connect to social media platform APIs.
  3. Set up your data storage system.
  4. Configure real-time data streaming.

Conduct sentiment analysis with social media data

The next step involves conducting sentiment analysis on social media data. Here’s how it works:

  1. Collect posts using relevant hashtags related to your brand, product, or campaign.
  2. Feed the collected posts into an LLM using a prompt for sentiment analysis.
  3. The LLM processes the textual content and outputs classifications (for example, positive, negative, or neutral) and explanations.

The following code is an example using the AWS SDK for Python (Boto3) that prompts the LLM for sentiment analysis:

import boto3
import json

# Initialize Bedrock Runtime client
bedrock = boto3.client('bedrock-runtime')

def analyze_sentiment(text, model_id= {selected_model}):
    # Construct the prompt
    prompt = f"""You are an expert AI sentiment analyst with advanced natural language processing capabilities. Your task is to perform a sentiment analysis on a given social media post, providing a classification of positive, negative, or neutral, and detailed rationale.

    Inputs:
    Post: "{text}"

    Instructions:
    1. Carefully read and analyze the provided post content.
    2. Consider the following aspects in your analysis:
        - Overall tone of the message
        - Choice of words and phrases
        - Presence of emotional indicators (such as emojis, punctuation)
        - Context and potential sarcasm or irony
        - Balance of positive and negative elements, if any
    3. Classify the sentiment as one of the following:
        - Positive: The post expresses predominantly favorable or optimistic views
        - Negative: The post expresses predominantly unfavorable or pessimistic views
        - Neutral: The post lacks strong emotion or balances positive and negative elements.
    4. Explain your classification with specific references to the post

    Provide your response in the following format:
    Sentiment: [Positive/Negative/Neutral]
    Explanation: [Detailed explanation of your classification, including:
        - Key words or phrases that influenced your decision
        - Analysis of any emotional indicators
        - Discussion of context and tone
        - Explanation of any ambiguities or mixed signals]

    Remember to be objective and base your analysis solely on the content of the post. If the sentiment is ambiguous or context-dependent, acknowledge this in your explanation.
    """

    # Create the request body
    body = json.dumps({
        "prompt": prompt,
        "max_tokens_to_sample": 500,
        "temperature": 0.5,
        "top_p": 1
    })

    # Invoke the model
    response = bedrock.invoke_model(
        modelId=model_id,
        body=body
    )

    return json.loads(response['body'].read())

This analysis provides valuable insights into public perception, providing marketers the information they need to understand how their brand or campaign is resonating with the audience in real time.

The following output examples were obtained using Amazon Bedrock:

Sentiment analysis for Large Language Models:
=================================================

EXAMPLE PROMPT:
-------------------------------------------------
Analyze the sentiment of the following post. Classify it as positive, negative, or neutral, and provide a brief explanation for your classification.

Post: "Avoid [AnyCompany] printer ink refills at all costs! Leaked everywhere, and barely lasted a week. Overpriced. #PrinterInkNightmare #AnyCompanyFail"

Sentiment:
Explanation:
-------------------------------------------------

Using Amazon Nova Pro:
=====================================
Sentiment: Negative

Explanation: The post expresses strong dissatisfaction with [AnyCompany] printer ink refills. The author uses phrases like "avoid at all costs," "leaked everywhere," "barely lasted a week," and "overpriced," all of which convey a highly negative experience. Additionally, the hashtags "#PrinterInkNightmare" and "#AnyCompanyFail" further emphasize the negative sentiment by highlighting the frustration and failure associated with the product.

Using Meta Llama 3.2 3B Instruct:
================================
Classification: Negative

Explanation: The post expresses strong dissatisfaction and warning to others about purchasing printer ink refills from "AnyCompany". The language used is emphatic, with words like "Avoid", "Leaked everywhere", and "Overpriced", which convey a sense of frustration and disappointment. The hashtags "#PrinterInkNightmare" and "#AnyCompanyFail" further emphasize the negative sentiment, suggesting that the author has had a terrible experience with the product.

Using Anthropic Claude 3.5 Sonnet:
==================================
Sentiment: Negative

Explanation: This post expresses a strongly negative sentiment towards [AnyCompany]'s printer ink refills. Several factors contribute to this classification:

The use of the phrase "Avoid... at all costs" indicates a strong recommendation against the product.

Multiple negative aspects of the product are mentioned: leaking, short lifespan, and high price.

The use of the hashtag "#PrinterInkNightmare" emphasizes the user's frustration and negative experience.

The hashtag "#AnyCompanyFail" directly criticizes the company, associating it with failure.

The overall tone is one of warning and disappointment, with no positive aspects mentioned.

The language used is emphatic and critical, clearly conveying the user's dissatisfaction with the product and the company. This post is likely intended to warn others away from the product, further reinforcing its negative sentiment.
===============================

Analyze campaign effectiveness and generate content

The next step focuses on using AI for content creation and campaign effectiveness prediction:

  1. Input campaign data points (target audience, messaging, channels, and so on) into an LLM tailored for generating marketing content.
  2. The LLM generates relevant content such as ad copy, social media posts, or email campaigns based on the provided data.
  3. Another LLM, designed for campaign effectiveness analysis, evaluates the generated content.
  4. This analysis model outputs a score or measure of the content’s potential effectiveness, considering the campaign objectives and insights from the social media sentiment analysis.

Content generation

The following is an example that prompts a selected LLM for content generation:

import boto3
import json

# Initialize Bedrock Runtime client
bedrock = boto3.client('bedrock-runtime')

def generate_marketing_content(
    product,
    target_audience,
    key_message,
    tone,
    platform,
    char_limit,
    model_id= {selected_model}
):
    prompt = f"""You are an expert AI social media copywriter with extensive experience in creating engaging, platform-specific content for marketing campaigns. Your task is to craft a compelling social media post based on the provided campaign details.

    Inputs:
    Product: {product}
    Target Audience: {target_audience}
    Key Message: {key_message}
    Tone: {tone}
    Platform: {platform}
    Character Limit: {char_limit}

    Instructions:
    1. Carefully review all provided information.
    2. Craft a social media post that:
        - Accurately represents the product
        - Resonates with the target audience
        - Clearly conveys the key message
        - Matches the specified tone
        - Is optimized for the given platform
        - Adheres to the character limit
    3. Incorporate platform-specific best practices (i.e. hashtags for Twitter/Instagram, emojis if appropriate)
    4. Make sure the post is attention-grabbing and encourage engagement (likes, shares, comments)
    5. Include a call-to-action if appropriate for the campaign

    Provide your response in the following format:
    Generated Post: [Your social media post here, ensuring it's within the character limit]

    Remember to be creative, concise, and impactful. Ensure your post aligns perfectly with the provided campaign details and platform requirements.
    """

    body = json.dumps({
        "prompt": prompt,
        "max_tokens_to_sample": 300,
        "temperature": 0.7,
        "top_p": 0.9
    })

    response = bedrock.invoke_model(
        modelId=model_id,
        body=body
    )

    return json.loads(response['body'].read())

The following output examples were obtained using Amazon Bedrock:

Text generation Prompt for Large Language Models:
=================================================
Create a social media post for the following marketing campaign:

Product: [AnyCompany printer ink cartridge refills]
Target Audience: [Home Office or small business users]
Key Message: [lower cost with same or similar results as original branded ink cartridges]
Tone: [Desired tone, e.g., friendly, professional, humorous]
Platform: [Social media platform, e.g., Bluesky]
Character Limit: [75]

Using Amazon Nova Pro:
=====================================
🖨 Save big on printing! Try [AnyCompany] ink cartridge refills for your home office or small biz. Enjoy lower costs with quality that matches the originals. Print smart, print affordable. 💼💰
#PrintSmart #CostSaving #AnyCompanyInk


Using Meta Llama 3.2 3B Instruct:
================================
"Ditch the expensive original ink cartridges! Our refill cartridges are made to match your printer's original quality, at a fraction of the cost. Save up to 50% on your ink needs!"
#InkSavers #PrintOnABudget


Using Anthropic Claude 3.5 Sonnet:
===============================
"Print more, pay less! AnyCompany refills: OEM quality, half the price."
#SmartOffice

Campaign effectiveness analysis

The following is an example of code that prompts the selected LLM for campaign effectiveness analysis:

import boto3
import json

# Initialize Bedrock Runtime client
bedrock = boto3.client('bedrock-runtime')

def analyze_campaign_effectiveness(
    campaign_objectives,
    sentiment_summary,
    marketing_content,
    model_id= {selected_model}
):
    prompt = f"""You are an expert AI marketing analyst with extensive experience in evaluating marketing campaigns. Your task is to assess a marketing campaign based on its content and alignment with objectives. Provide a thorough, impartial analysis using the information given.

    Inputs:
    Campaign Objectives: {campaign_objectives}
    Positive Sentiments: {sentiment_summary['praises']}
    Negative Sentiments: {sentiment_summary['flaws']}
    Marketing Content: {marketing_content}

    Instructions:
    1. Carefully review all provided information.
    2. Analyze how well the marketing content aligns with the campaign objectives.
    3. Consider the positive and negative sentiments in your evaluation.
    4. Provide an Effectiveness Score on a scale of 1-10, where 1 is completely ineffective and 10 is extremely effective.
    5. Give a detailed explanation of your evaluation, including:
        - Strengths of the campaign
        - Areas for improvement
        - How well the content addresses the objectives
        - Impact of positive and negative sentiments
        - Suggestions for enhancing campaign effectiveness

    Provide your response in the following format:
    1. Effectiveness Score: [Score]/10
    2. Detailed explanation of the evaluation: [Your detailed explanation here, structured in clear paragraphs or bullet points]

    Remember to be objective, specific, and constructive in your analysis. Base your evaluation solely on the provided information.
    """

    body = json.dumps({
        "prompt": prompt,
        "max_tokens_to_sample": 800,
        "temperature": 0.3,
        "top_p": 1
    })

    response = bedrock.invoke_model(
        modelId=model_id,
        body=body
    )

    return json.loads(response['body'].read())

Let’s examine a step-by-step process for evaluating how effectively the generated marketing content aligns with campaign goals using audience feedback to enhance impact and drive better results.

The following diagram shows the logical flow of the application, which is executed in multiple steps, both within the application itself and through services like Amazon Bedrock.

Campaign effectiveness analysis process

The LLM takes several key inputs (shown in the preceding figure):

  • Campaign objectives – A textual description of the goals and objectives for the marketing campaign.
  • Positive sentiments (praises) – A summary of positive sentiments and themes extracted from the social media sentiment analysis.
  • Negative sentiments (flaws) – A summary of negative sentiments and critiques extracted from the social media sentiment analysis.
  • Generated marketing content – The content generated by the content generation LLM, such as ad copy, social media posts, and email campaigns.

The process involves the following underlying key steps (shown in the preceding figure):

  • Text vectorization – The campaign objectives, sentiment analysis results (positive and negative sentiments), and generated marketing content are converted into numerical vector representations using techniques such as word embeddings or Term Frequency-Inverse Document Frequency (TF-IDF).
  • Similarity calculation – The system calculates the similarity between the vector representations of the generated content and the campaign objectives, positive sentiments, and negative sentiments. Common similarity measures include cosine similarity or advanced transformer-based models.
  • Component scoring – Individual scores are computed to measure the alignment between the generated content and the campaign objectives (objective alignment score), the incorporation of positive sentiments (positive sentiment score), and the avoidance of negative sentiments (negative sentiment score).
  • Weighted scoring – The individual component scores are combined using a weighted average or scoring function to produce an overall effectiveness score. The weights are adjustable based on campaign priorities.
  • Interpretation and explanation – In addition to the numerical score, the system provides a textual explanation highlighting the content’s alignment with objectives and sentiments, along with recommendations for improvements.

The following is example output for the marketing campaign evaluation:

1. Effectiveness Score: 8/10
2. Detailed explanation of the evaluation:

Campaign Objectives:
•	Increase brand awareness by 20%.
•	Drive a 15% increase in website traffic.
•	Boost social media engagement by 25%.
•	Successfully launch the ink refill product.

Positive Sentiments:
•	Creative and resonant content.
•	Clear messaging on cost savings and quality.
•	Effective use of hashtags and emojis.
•	Generated positive buzz.

Negative Sentiments:
•	Tone too casual for brand image.
•	Weak call to action.
•	Overly focused on cost savings.

Marketing Content:
•	Social media posts, email campaigns, and a website landing page.

Strengths:
•	Engaging and shareable content.
•	Clear communication of benefits.
•	Strong initial market interest.

Areas for Improvement:
•	Align tone with brand image.
•	Strengthen call to action.
•	Balance cost focus with value proposition.

The campaign effectiveness analysis uses advanced natural language processing (NLP) and machine learning (ML) models to evaluate how well the generated marketing content aligns with the campaign objectives while incorporating positive sentiments and avoiding negative ones. By combining these steps, marketers can create data-driven content that is more likely to resonate with their audience and achieve campaign goals.

Impact and benefits

This AI-powered approach to marketing intelligence provides several key advantages:

  • Cost-efficiency – By predicting campaign effectiveness upfront, companies can optimize resource allocation and minimize spending on underperforming campaigns.
  • Monetizable insights – The data-driven insights gained from this analysis can be valuable not only internally but also as a potential offering for other businesses in the industry.
  • Precision marketing – A deeper understanding of audience sentiment and content alignment allows for more targeted campaigns tailored to audience preferences.
  • Competitive edge – AI-driven insights enable companies to make faster, more informed decisions, staying ahead of market trends.
  • Enhanced ROI – Ultimately, better campaign targeting and optimization lead to higher ROI, increased revenue, and improved financial outcomes.

Additional considerations

Though the potential of this approach is significant, there are several challenges to consider:

  • Data quality – High-quality, diverse input data is key to effective model performance.
  • Model customization – Adapting pre-trained models to specific industry needs and company voice requires careful adjustment. This might involve iterative prompt engineering and model adjustments.
  • Ethical use of AIResponsible AI use involves addressing issues such as privacy, bias, and transparency when analyzing public data.
  • System integration – Seamlessly incorporating AI insights into existing workflows can be complex and might require changes to current processes.
  • Prompt engineering – Crafting effective prompts for LLMs requires continuous experimentation and refinement for best results. Learn more about prompt engineering techniques.

Clean up

To avoid incurring ongoing charges, clean up your resources when you’re done with this solution.

Conclusion

The integration of generative AI and large LLMs into marketing intelligence marks a transformative advancement for the media and entertainment industry. By combining real-time sentiment analysis with AI-driven content creation and campaign effectiveness prediction, companies can make data-driven decisions, reduce costs, and enhance the impact of their marketing efforts.

Looking ahead, the evolution of generative AI—including image generation models like Stability AI’s offerings on Amazon Bedrock and Amazon Nova’s creative content generation capabilities—will further expand possibilities for personalized and visually compelling campaigns. These advancements empower marketers to generate high-quality images, videos, and text that align closely with campaign objectives, offering more engaging experiences for target audiences.

Success in this new landscape requires not only adoption of AI tools but also developing the ability to craft effective prompts, analyze AI-driven insights, and continuously optimize both content and strategy. Those who use these cutting-edge technologies will be well-positioned to thrive in the rapidly evolving digital marketing environment.


About the Authors

Arghya Banerjee is a Sr. Solutions Architect at AWS in the San Francisco Bay Area, focused on helping customers adopt and use the AWS Cloud. He is focused on big data, data lakes, streaming and batch analytics services, and generative AI technologies.

Dhara Vaishnav is Solution Architecture leader at AWS and provides technical advisory to enterprise customers to use cutting-edge technologies in generative AI, data, and analytics. She provides mentorship to solution architects to design scalable, secure, and cost-effective architectures that align with industry best practices and customers’ long-term goals.

Mayank Agrawal is a Senior Customer Solutions Manager at AWS in San Francisco, dedicated to maximizing enterprise cloud success through strategic transformation. With over 20 years in tech and a computer science background, he transforms businesses through strategic cloud adoption. His expertise in HR systems, digital transformation, and previous leadership at Accenture helps organizations across healthcare and professional services modernize their technology landscape.

Namita Mathew is a Solutions Architect at AWS, where she works with enterprise ISV customers to build and innovate in the cloud. She is passionate about generative AI and IoT technologies and how to solve emerging business challenges.

Wesley Petry is a Solutions Architect based in the NYC area, specialized in serverless and edge computing. He is passionate about building and collaborating with customers to create innovative AWS-powered solutions that showcase the art of the possible. He frequently shares his expertise at trade shows and conferences, demonstrating solutions and inspiring others across industries.

Source: https://aws.amazon.com/blogs/machine-learning/elevate-marketing-intelligence-with-amazon-bedrock-and-llms-for-content-creation-sentiment-analysis-and-campaign-performance-evaluation/



You might also like this video

Leave a Reply

Available for Amazon Prime