ExAbby.LiveViewHelper (ex_abby v0.3.0)
Functions to handle A/B testing in a LiveView scenario:
- Using session-based logic, but with no direct
conn - Checking
connected?(socket)before creating/recording
Summary
Functions
For a LiveView mount with multiple experiments
Links session-based trials to a user for a LiveView socket.
Sets a specific variation for a session-based experiment in LiveView. Returns {:ok, trial} if successful, {:error, reason} otherwise.
Functions
For a LiveView mount with multiple experiments:
socket = ExAbby.LiveViewHelper.fetch_session_exp_variations_lv(socket, session, ["exp1", "exp2"])- Checks if
connected?(socket)(true once the WS is established) - If connected, reads
ex_abby_session_idfromsession - Calls the underlying function to get or create a trial
- Assigns
:ab_variationin the socket - Returns the updated socket
Returns socket with :ex_abby_trials assigned as a map of %{experiment_name => variation_name}
Links session-based trials to a user for a LiveView socket.
Sets a specific variation for a session-based experiment in LiveView. Returns {:ok, trial} if successful, {:error, reason} otherwise.