Answers.Body: <p>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). </p>
  
  <p>So in the email, I use smarty:</p>
  
  <pre><code>{if $contact_id % 2}
     one of the two texts I want to test
  {else}
     and the other test I want
  {/if}
  </code></pre>
  
  <p>And measure the result:</p>
  
  <pre><code>SELECT count(id) as total, mod(id,2) as bucket FROM civicrm_contact join whatever ... group by mod(id,2);
  </code></pre>
  
  <p>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?</p>
  
  <p>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...</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-07T15:14:48.263Z
Answers.Text: Very clever IMO!
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-07T12:54:38.420Z
Answers.LastActivityDate: 2016-01-07T15:31:56.527Z
Answers.LastEditDate: 2016-01-07T15:31:56.527Z
Answers.UserDisplayName: Xavier
Body: <p>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.</p>
  
  <p>Is there an easy way to implement that, eg could I leverage some of the existing features of the ab testing in civimail?</p>
  
Tags: <email><abtesting>
Title: How to do ab testing on transactional emails?
ThreadText: # How to do ab testing on transactional emails?
  
  (Asked by: username_0 on 2016-01-07)
  
  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?
  
  **Tags:** email, abtesting
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-01-07. Score: 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
  {else}
     and the other test I want
  {/if}
  
  ```
  
  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...
  
  > **Comments:**
  > **username_1**: Very clever IMO!  
  
  ---
  
  