Skip to content

Commit

Permalink
"Send test email" - Add notice about A/B testing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
totten committed Feb 2, 2024
1 parent d861d12 commit 43febe0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ang/crmMosaico/BlockPreview.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@
<button type="button" class="btn btn-sm btn-primary" title="{{ crmMailing.$invalid || !testGroup.gid ? ts('Complete all required-mark fields first') : ts('Send test message to group') }}" ng-disabled="crmMailing.$invalid || !testGroup.gid" crm-confirm="{resizable: true, width: '40%', height: '40%', open: previewTestGroup}"
on-yes="doSend({gid: testGroup.gid})">{{:: ts('Send test') }}</button>
</div>

<div class="form-group" ng-if="isSplit(mailing)">
<em>{{ts('The draft mailing allows two variations (A/B).')}}<br/>{{ts('If you send a test now, it will use all available variations.')}}</em>
</div>
3 changes: 2 additions & 1 deletion ang/crmMosaico/BlockPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// example: <div crm-mailing-block-preview crm-mailing="myMailing" on-preview="openPreview(myMailing, preview.mode)" on-send="sendEmail(myMailing,preview.recipient)">
// note: the directive defines a variable called "preview" with any inputs supplied by the user (e.g. the target recipient for an example mailing)

angular.module('crmMosaico').directive('crmMosaicoBlockPreview', function(crmUiHelp) {
angular.module('crmMosaico').directive('crmMosaicoBlockPreview', function(crmUiHelp, crmMosaicoVariants) {
return {
templateUrl: '~/crmMosaico/BlockPreview.html',
link: function(scope, elm, attr) {
Expand All @@ -25,6 +25,7 @@

return ($.inArray(false, validityArr) == -1);
};
scope.isSplit = crmMosaicoVariants.isSplit;

scope.doPreview = function(mode) {
scope.$eval(attr.onPreview, {
Expand Down
11 changes: 10 additions & 1 deletion ang/crmMosaico/Variants.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,17 @@
return preview;
},

// isSplit(mailing): Determine if there are -any- split/variant fields.
// isSplit(mailing, field): Determine if a -specific- field has variations.
isSplit: function isSplit(mailing, field) {
return mailing.template_options && mailing.template_options.variants && (field in mailing.template_options.variants[0]);
if (!mailing.template_options || !mailing.template_options.variants) {
return false;
}
if (field) {
return (field in mailing.template_options.variants[0]);
}
const nonEmpties = _.filter(mailing.template_options.variants, (v) => !_.isEmpty(angularObj(v)));
return nonEmpties.length > 0;
}
};
return self;
Expand Down

0 comments on commit 43febe0

Please sign in to comment.