Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add A/B testing for email design #633

Merged
merged 13 commits into from
Mar 1, 2024

Conversation

totten
Copy link
Collaborator

@totten totten commented Feb 2, 2024

Overview

Expands support for A/B testing.

This is currently marked "Draft" because there are a couple TODOs (noted at bottom of PR). However, it should work well enough that one can do some testing. (Resolved)

ping @kurund

Before

  • You may add a second "Subject" field, which enables A/B testing. (By default, it copies your current subject.)

After

  • You may add a second "Subject" field, which enables A/B testing. (By default, it copies your current subject.)

  • You may add a second "Design" section, which enables A/B testing. (By default, it copies your current design.)

    Screenshot 2024-02-01 at 10 32 08 PM

    After doing this, you will see "Design (A)" and "Design (B)".

    Screenshot 2024-02-01 at 10 28 56 PM
  • It is possible to mix/match testing at the "Subject"-level and the "Design"-level. The GUI provides separate options for enabling/disabling each of these. These should be working in both "Single Page" and "Wizard" layouts.

  • (Aside: I moved the "A/B testing" percentage-sliders toward the end of the "New Mailing" screen. When there are multiple ways to enable A/B testing, it's a bit confusing if the sliders popup earlier in the UI. The new placement ensures that the sliders appear you've made all the decisions about whether to test subject and/or design.)

Technical Details

Within a Mailing record, there is a section template_options.variants[0,1]. The existing AbDemux component reads this property and generates "A" and "B" mailings (if present). This is how the subject-testing works. This PR follows the same path for testing two values of body_html. The existing AbDemuxTest already has scenarios for multiple body_html variants.

Here are a few examples of how the content ought to look:

Example: JSON for single subject and single design
{
  id: 123,
  subject: "Apples are the best fruit",
  body_html: "<html>...yummy...</html>",
  template_options: {
    mosaicoTemplate: "basic-versafix-1",
    mosaicoMetadata: "{...}",
    mosaicoContent: "{...yummy...}"
  }
}
Example: JSON for dual subject and dual design
{
  id: 123,
  subject: "PLACEHOLDER",
  body_html: "PLACEHOLDER",
  template_options: {
    variants: [
      {
        subject: "Apples are the best fruit",
        body_html: "<html>...yummy apple...</html>",
        mosaicoTemplate: "basic-versafix-1",
        mosaicoMetadata: "{...}",
        mosaicoContent: "{...yummy apple...}"
      },
      {
        subject: "Bananas are the best fruit",
        body_html: "<html>...yummy banana...</html>",
        mosaicoTemplate: "basic-versafix-1",
        mosaicoMetadata: "{...}",
        mosaicoContent: "{...yummy banana...}"
      }

    ]
  }
}

In comparing the examples, observe:

  • If the subject is tested, then we move subject into mailing.template_options.variants.[0,1].subject.
  • If the body_html (w/mosaicoContent, etc) is tested, then we move the body_html (w/mosaicoContent, etc) into mailing.template_options.variants.[0,1].body_html.

Most of the work in developing this PR has been about updating web UI to consistently populate+cleanup the data in template_options.variants (based on whether the user activates subject and/or body_html variations).

TODO

  • When you use editor, there are options to "Preview" (in browser) or "Send test" (via email). This is basically working for "Send test" (but not stress-tested yet). However, the "Preview" is not yet working.
  • Submit a mailing and try out the full flow of two blasts (followed by third/final blast).

When we add support for "A/B" testing of different message-bodies, there
will be more ways to enable "A/B" testing.  We may not know on the first
screen whether "A/B" is active.

This moves the "A/B" distribution options to the end -- at which point, we
will know for sure whether "A/B" testing is active.
Do you want or expect this button to send one message or two messages? It depends.

* Heretofore, with subject-based A/B, the user intent was a bit ambiguous --
  but the imperative was to send both. The user needs *some* way to send
  each A/B condition -- but there's only one button for sending. So that
  button sends both.

* Now, with design-based A/B, you might reasonably infer user-intent. When
  editing "Design (A)", you send a test for "Design (A)". When editing "Design (B)",
  you send a test for "Design (B)". You can navigate back+forth to send
  whichever test you want.

* But OTOH, the user now has a choice.  They may do subject-based, design-based, or both. So:
    * If you always send the one being edited, then it's good for design-based.
    * If you always send both, then it's good for subject-based.
    * If you send one-or-both dynamically, then it's inconsistent.

* IMHO, whether subject-based or design-based, it's still not bad to send
  both.  When you go to read the messages in your email client, you can
  quickly compare the latest rendering of each.

* The main thing is to be clear about what's happening.
@totten totten marked this pull request as ready for review February 2, 2024 23:45
@totten
Copy link
Collaborator Author

totten commented Feb 2, 2024

OK, I fixed the "Preview" issue and clarified the "Send test email" behavior. A trial-run with three deliveries (A+B+Winner) went fine.

It should be good for review/testing.

@seamuslee001
Copy link
Contributor

@johntwyman you were saying :)

@kurund
Copy link
Contributor

kurund commented Feb 23, 2024

@totten

Thank you for the work.

A/B version for the message seems be working as expected. However, I don't see an option for selecting A/B for From. Am I missing something?

@mattwire
Copy link
Collaborator

mattwire commented Mar 1, 2024

Merging based on discussion with @totten

@mattwire mattwire merged commit 54db52e into veda-consulting-company:2.x Mar 1, 2024
1 check passed
@totten
Copy link
Collaborator Author

totten commented Mar 1, 2024

Thanks @kurund. I hadn't realized the From was also a target. It shouldn't be big a change (probably a few hours; a lot easier than the template body/metadata). So we'll go at that in a follow-up PR.

@totten totten deleted the 2.x-ab-body2 branch March 1, 2024 14:45
@kurund
Copy link
Contributor

kurund commented Mar 4, 2024

@totten

Ok thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants