How to Add A/B Testing Cookie Into a SQL Query for a Webpart/Transformation

kentico guy asked on October 16, 2020 15:18

Kentico 12 portal engine:

I am building out a custom query that will take the A/B testing cookie and pass it into a SQL query. What's the easiest way (at a high level) of passing a cookie into a webpart query? If I don't get a response I'll try to remember to post the method once I figure it out.

I don't really need code just a simple high level on how it could be done. If you do have code you can post it but even a high level will work for me. Just looking for advice before I get started building it out.

Thanks, in advance!

Recent Answers

Dmitry Bastron answered on October 16, 2020 16:00


Using the cookie value in SQL query sounds like a weird use case for A/B testing. What are you trying to achieve with this?

I think this approach might work for you instead:

  • Add a field into your webpart that will store the value for your URL parameter
  • On page variant A configure webpart to use "value_A" value
  • On page variant B configure webpart to use "value_B" value
  • On page open Kentico will serve variant A or B with correct URL parameter in your HTML markup that you can use however you want
0 votesVote for this answer Mark as a Correct answer

kentico guy answered on October 16, 2020 20:01

We have a transformation on the homepage that shows recently created articles. We want to assign either an A or B cookie to the homepage then show the user only one article preview or another. We don't want to have two separate versions of the homepage. I think it would be more efficient to just pass a cookie value into the query and pull either set A or set B

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.