Articles in this section

Offer Assignment and Generative Text for Campaigns

Introduction

MessageGears' integration with Snowflake Cortex has opened up new use cases for enterprise marketers interested in making the most of their data investments. In this article, we'll review a holistic offer assignment and generative text end-to-end use case.

In this article, we'll cover how to use data + AI to:

  1. Best choose an offer for a customer based on their customer demographics and purchase history
  2. Generate sample offer text for each customer
  3. Measure messaging variants that convert, and iterate on other creative variants

Sample DDL's and sql statements to create the customer table and generate the offers can be found here and here. 

Benefits of MessageGears Direct Data Access with Cortex AI for Campaign Creation

  • Classification models using the entirity of a customer's data profile will be much more accurate and yield higher lifetime customer value than providers using a fraction of the data set
  • Direct data access coupled with Cortex AI creates an unlimited amount of campaign creative with a much lower bandwidth compared to manual campaign creation

Background and Scenario

Imagine that we’re on the customer engagement and marketing team for City and Glory™, a furniture brand with a large global presence.x In this use case, we have been assigned with creating a national campaign that assigns different offers and discounts and sends an email to customers that will most likely get them to purchase.

In this example, we will use Snowflake Cortex to help generate an offer between:

  • Buy One Get One Free (BOGO)
  • 25% Off
  • No Discount

We will then use the combined power of MessageGears and Cortex to use generative AI to create offer text that best suits that user and send the email with that text in the hero copy.

 

Let’s Get Started.

Assigning Customer Offers

Much of the setup and data section is going to be using Snowflakes Following along from Snowflake's Multi-Class Classifier Function

As opposed to binary classification where we'd determine between two outcomes (discount or no discount), the multiple class classifier is a more difficult use case of determining the "best" outcome from multiple for each customer. In this use case, we will use Cortex to attempt to determine the best offer for each customer based on their unique brand interaction and customer demographic information. 

Source: Medium

Assemble the Data

To begin, we'll want to make sure we have properly assembled all of the data we'll need to make a successful prediction of each customer. In this example, we'll review the steps at a high level, check out Creating a Member Profile Table for a deeper dive on the kinds of data points data-savvy marketers can use to create a better view of their customer.

Helpful identifiers and customer behaviors that will feed our model include:

    • Name
    • Recent purchases
    • High/Low/Med Lifetime Value
    • Customer membership program
    • Purchases_last_year (i.e. num purchases over the past 12 months)
    • Purchase_value_last_year (i.e. total purchase value over the past 12 months)
    • Age
    • Location
    • Last Offer Sent Before Purchase
First Name Recent purchase High/Low/Med Value Customer membership program Purchases last_year  Purchase_value last_year  Last Offer Sent Before Purchase
Nick Y Low Y 4 $48.52 BOGO
Chris N Med Y 52 $72.90 50% Off
Jordan Y High N 12 $4,280.20 20% Off
Taylor Y High N 0 $5,384.89 None
Elizabeth N Low N 2 $20.00 BOGO

 

A sample DDL to create a reference member profile table within Snowflake is available Here.

Some key considerations when assembling member data:

  • Numeric features are treated as continuous. To treat numeric features as categorical, cast them to strings.
  • String features are treated as categorical. The classification function supports high-cardinality features (for example, job titles or fruits). It does not support full free text, like sentences or pargraphs.
  • Boolean features are treated as categorical.
  • The Cortex model can handle NULL values in features.
  • Timestamps must be TIMESTAMP_NTZ type. 
  • The cardinality of the label (target) column must be greater than one and less than the number of rows in the dataset.

Train the Model

This section relies heavily on the information found in Snowflake's Documentation. While explicit steps can be found on that page, a high level summation of model training can be:

  1. Assembling the full view of the customer (previous section)
    1. Ensure that only valid columns are included in training data. Any unnecessary or stochastically deterministic elements (such as tying customer ID's or payment ID's to payment success) will result in faulty model results
    2. Include MessageGears Blueprint Segments in your training data for accurate predictions
  2. Ensure you include fallback and NULL logic within your training set for success in campaign preparation
  3. Train the model on the correct ‘offer assignment’
  4. Predict the offer for today’s audience and create fallback/NULL logic

Sample output data from the model (columns truncated for readability) may look like:

Customer_Id Segments Prediction
0001 High Spender, In-Store {class: "BOGO",
logs: null,
probability: {
Discount: 3.529288000000000e-04,
No_Offer: 2.259768000000000e-04,
BOGO: 9.994210944000000e-01}}
0002 Low Spender, Digitally Active {class: "No_Offer",
logs: null,
probability: {
Discount: 3.201690000000000e-04,
No_Offer: 9.994749885000000e-01,
BOGO: 2.048425000000000e-04}}
0003 Medium Spender, Birthday Campaign {class: "BOGO",
logs: null,
probability: {
Discount: 1.271809310000000e-02,
No_Offer: 3.992673600000000e-03,
BOGO: 9.832892333000000e-01}}
0004 Low Spender {class: "Discount",
logs: null,
probability: {
Discount: 9.999112027000000e-01,
No_Offer: 4.612520000000000e-05,
BOGO: 4.267210000000000e-05}}
0005 NULL {class: "No_Offer",
logs: null,
probability: {
Discount: 2.049559150000000e-02,
No_Offer: 9.759854413000000e-01,
BOGO: 3.518967300000000e-03}}

Generating Offers

At this stage, we have created our complete view of the customer and used it to train and assign offers to different customers. At this stage, we'll use the advanced Generative Text operations within Cortex to define the creative copy that we'd like to use for different customers.

This step is optional. Many MessageGears customers can lift customer LTV and save hundreds of hours of work simply by assigning offers within the database. 

A rough outline of using the enhanced workflows to include generative text include:

  1. Feed the resulting view from the Assemble the Data step into one of the generative functions:
    1. The TRY_COMPLETE() function is useful for feeding the audience member and context alongside the assigned offer for creative copy.
    2. Sentiment Analysis on any new reviews or inbound content from audience members can be used to understand their brand sentiment and, alongside NPS scores, be used to structure the communication
    3. The Translation Functionality allows any new offers to be natively translated into copy in several different languages
  2. Structuring resultant queries using the full context of the audience and offer
    1. For example, “I’m a national retail brand who is potentially sending an offer to one of my customers. My customer’s name is <NAME>, they’re <AGE> years old, and they’re being assigned offer <CLASSIFICATION>. Please write some copy for an email to go to them that fits this new classification.”
    2. Ensure you have NULL and fallback logic for any offer creation
  3. Attach the resultant data into your final audience data for upload
  4. Fine Tune your model over time to ensure the best results for each data set

The resultant data set should include customer personalization information, as well as their offer and any creative detail being referenced within the template. Sample data (with columns truncated):

Customer ID Segments Offer Creative
1 High Spender, In-Store BOGO Great news! Two for one pricing TODAY ONLY
2 Low Spender, Digitally Active No_Offer Check out our specials today!
3 Medium Spender, Birthday Campaign BOGO Vibe Check - buy one get one free!
4 Low Spender Discount Save as much as 40% now
5 NULL No_Offer Your Weekly Digest

Whether you're using Cortex to assign offers or are using the enhanced workflow generating offers, move to the next step to send the campaign.

Creating the Campaign

Once the data is in a good place to be trained to generate correct offers, it's time to use the MessageGears Audience Builder and Campaign Creator.

Selecting an Audience

To begin, ensure that you have set up your table mentioned above as your campaign audience. You can configure this either in our Audience Builder or within a dedicated Blueprint, where MessageGears segments can map audience members to different activation methods and channels:

An important distinction to remember: Include the Snowflake-generated offers in either your audience or Context Data data, as that is how MessageGears will be able to assemble the final creative.

After assembling our finalized audience with offers included, we're ready to create and send our campaign

Creating the Campaign

Drawing from our articles on Creating and Testing Campaigns and Creating and Managing Templates, merge your sample creative with your audience to create your finished campaign.

Build the campaign: Set up a campaign with different hero copy and images with different offer logic in snippet and share content data

Assign Campaign Variables: Use MessageGears campaign variables as fallback copy and text for when the model doesn’t have an answer

Launch the Campaign: After testing, schedule your campaign to launch to your nationwide audience

Measuring Campaign and Model Performance

Limitations and Cost considerations

There are a handful of logical limitations to what the Snowflake Cortex training models can reference:

  • Training and inference data must be numeric, TIMESTAMP_NTZ, Boolean, or string. Other types must be cast to one of these types.
  • You cannot choose or modify the classification algorithm.
  • Model parameters cannot be manually specified or adjusted.
  • Training supports a maximum of 1,000 columns and 10 million rows, although it is possible to run out of memory below this limit. In this case, try a larger warehouse.
  • Your target column must contain no more than 255 distinct offers

Additionally, Training and using classification models incurs compute and storage costs within Snowflake (not MessageGears).

Using any functionality from the Classification feature (training a model, predicting with the model, retrieving metrics) all require an active warehouse. The compute cost of using Classification functions is charged to the warehouse.

See Snowflake's Understanding Compute Cost for general information on Snowflake compute costs.

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.