We would like to do an A/B Test using two different subject lines (Which is easy). We also want one of the subject lines to contain personalisation (which is also easy). However not everyone has a firstname specified.

When using A/B subject line testing are you able to use AMP scripting in the subject line - so we can add the logic of 'IF FIRSTNAME IS EMPTY THEN SAY 'XXXX' ELSE 'Hi %%firstName, here is your subject line'.

I have tried setting it up - has anyone successfully added AMP scripting in the subject line whilst using AB split tesing?


2 Answers 2


How I typically do this


set @subjectline = "Don't miss out on these offers"
set @firstname = FirstName

if Not Empty(@firstname) then
    set @subjectline = Concat(@firstname,", ",@subjectline)


Then set the subject line to be %%=v(@subjectline)=%%.


OK - so after much testing I managed to get this to work. In the HTML I included the following code which specifies the 2 different subject lines.

%%[ SET @firstName = [firstName] SET @Subject1 = Concat(v(@firstName),", Don't miss out on these offers") SET @Subject2 = "You have no first name :(" ]%%

Then in the A/B split test - I set one of the subject lines to: %%[ if not empty(@firstName) then ]%%%%= v(@Subject1) =%%%%[ else ]%%%%= v(@Subject2) =%%%%[ endif]%%

So if firstname is NOT empty then pull in Subject 1, otherwise pull in Subject 2.

Seemed to work - have done a full test and the AB test worked fine - and all the proofs were as expected. Let me know if anyone else can think of an easier way.

  • That's the way I typically do it. Sometimes I'll use the iif() function, depending on the number of words: e.g. %%=iif(empty(firstname),"normal subject",concat(firstname,", personalized subject"))=%% Commented Feb 1, 2015 at 21:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .