I'd like to A/B test dynamic subject lines, however, I've been told this is only possible for the default version and isn't possible for the other versions. Is there any workaround to this, perhaps using AMPscript? Currently, for a newsletter, I have to upload four different Data Extensions and send four separate emails because of this limitation, which is incredibly time-consuming.
2 Answers
It sounds like you are looking to do an AB test within each of the four groups, which is totally doable. You can do a nested IF similar to the above.
Step 1: Split your data extensions's (DE) into two random groups - If you are using data filter activities in an automation to build right before send, the split can be done via SQL queries -- If you are manually uploading to SF each time I recommend adding an additional column (groupid) and using this method to add a value to your CSV marking them as either group 1 or 2 -- https://exceljet.net/formula/randomly-assign-people-to-groups
In your example you have 4 groups that you want to AB test, so I would take my data for each group and add 2 columns - groupname and testgroupid. Lets say you have summer, fall, winter, spring as your groupname and testgroupid is 1 or 2 (50/50 split).
step 2: Set up the nested ampscript to reference each of those two levels:
set @groupname=groupname
set @testgroupid=testgroupid
if @groupname == 'summer' then
if @testgroupid == '1' then
set @subject = 'Summer Subject 1'
else
set @subject = 'Summer Subject 2'
endif
elseif @groupname == 'spring' then
if @testgroupid == '1' then
set @subject = 'spring Subject 1'
else
set @subject = 'spring Subject 2'
endif
elseif @groupname == 'fall' then
if @testgroupid == '1' then
set @subject = 'fall Subject 1'
else
set @subject = 'fall Subject 2'
endif
elseif @groupname == 'winter' then
if @testgroupid == '1' then
set @subject = 'winter Subject 1'
else
set @subject = 'winter Subject 2'
endif
ELSE
set @subject='Default subject'
endif
This will let you put it all into one email which is great if you are good at analytics. If you aren't. Then I recommend that you split your data extensions's (DE) into two random groups - adding an additional column (groupid) and using this method to add a value to your CSV marking them as either group 1 or 2 -- https://exceljet.net/formula/randomly-assign-people-to-groups. Then sort and split into two uploads, Testid1 (A) and testid2 (B) and doing 2 emails - one for A and one for B. Then you would only need the simple ampscript, what was already provided:
FOR A
set @groupname=groupname
if @groupname == 'summer' then
set @subject = 'Summer Subject 1'
elseif @groupname == 'spring' then
set @subject = 'spring Subject 1'
elseif @groupname == 'fall' then
set @subject = 'fall Subject 1'
elseif @groupname == 'winter' then
set @subject = 'winter Subject 1'
ELSE
set @subject='Default subject'
endif
FOR B
set @groupname=groupname
if @groupname == 'summer' then
set @subject = 'Summer Subject 2'
elseif @groupname == 'spring' then
set @subject = 'spring Subject 2'
elseif @groupname == 'fall' then
set @subject = 'fall Subject 2'
elseif @groupname == 'winter' then
set @subject = 'winter Subject 2'
ELSE
set @subject='Default subject'
endif
Hope that helps
Use AMPScript is the best way to create Subjects with dynamic content. You only have to add the A/B/n conditions declaring the variables in the HTML body of the email and call it from the Subject as usual %%=v(@subject)=%%
.
In the email body:
SET @value_DE = Lookup('Name_DE','value_DE','subscriber_key',_subscriberkey)
VAR @subject
if @value_DE == 'AAA' then
set @subject = 'Subject 1'
elseif @value_DE == 'BBB' then
set @subject = 'Subject 2'
elseif @value_DE == 'CCC' then
set @subject = 'Subject 3'
ELSE
set @subject='Default subject'
endif
-
Thanks for your response fromero. How exactly do I do this? (I'm not very skilled with AMPscript). Commented May 13, 2019 at 16:03
-
-
Interesting formatting of if elseif and else statements. I would not format those like this and rather group them on the same level. That will help especially if you have more nested if else statements. Commented May 14, 2019 at 8:44
-
Thanks - really appreciate your help. Does this method make it possible to A/B/C test for all other dynamic versions and not just the default version? What do I need to put into the Data Extension? Do I need to put the subject lines against each email address? Commented May 14, 2019 at 9:00
-
In the Data Extension, you should only have the values you need to compare to choose one subject or another. You can add the message to display in the subject manually replacing 'Subject 1', 'Subject 2', 'Subject 3' or 'Default subject'. This code will automatically show the proper message based on the values for each contact. In the Subject line of the email you only have to add %%=v(@subject)=%%– fromeroCommented May 14, 2019 at 9:12