Some transactional emails have call to action (eg "click here to confirm your subscription") and I'd like to see if I can improve how many actions are taken by ab testing.

Is there an easy way to implement that, eg could I leverage some of the existing features of the ab testing in civimail?

1 Answer 1


What I'm doing right now is to use the contact id to split the contacts into two buckets (if it's odd, group A, even group B).

So in the email, I use smarty:

{if $contact_id % 2}
   one of the two texts I want to test
   and the other test I want

And measure the result:

SELECT count(id) as total, mod(id,2) as bucket FROM civicrm_contact join whatever ... group by mod(id,2);

It's a bit of a hack and needs a bit of sql massaging, but seems to work. Do you see any problem using the id % 2 as way to randomly distribute between the groups?

And I'd like to be able to measure open rate and click rate, but haven't quite figured that one yet. Any suggestion more than welcome...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.