My team is trying to run an AB test using 2 distinct flows throughout the form. We have collapsible sections and we're trying to figure out if having the topmost section always open would be better.
The way we've implemented this is by adding some control flow logic to see if the feature flag (named 'ALWAYS_SHOW_SECTION') is on the window and is true. The idea was to add a Custom Code modification to our A/B test in which we added
Are you running your activity through target-global? Do you see the network call to Target resolve and that your offer is in the response. Is that script tag the only thing in the offer? The script should execute as it makes it way back onto the page. Maybe your form logic is running too early or are you referring to a form with multiple steps.
I see nothing wrong with trying to use Adobe Target that way. Sorry for the barrage of questions.
We've had some internal help with our test. It turns out that our test URL was too strict and that is why we weren't seeing the feature originally. We see it now, but there's still a race condition.
Setting the variable on the window is the only thing that happens in our custom code block.
Is there anything we can do to combat this? We've had a colleague recommend that instead of inserting the code this way, we can insert a span with some id and have our code look for the span instead. Thoughts?
You can always get Target to respond back with one of 2 offers on a 50/50 split. Hide the content by default and let Target respond back with a function that does the rest of the work which is already defined on the page:
- Create local functions as mentioned below (on the page or local js)
- Hide form section entirely
- Call to Target
- A returns <script>unhideFormBlock()</script>
- B return <script> unhideAndCollapseFormBlock()</script>
- Can make sure function exist before calling it
If Target fails (there is an onError section of the getOffer) then choose one to be your non-Target experience. Can block Target in the network panel to test the fail case.
As a side note, this is what the page level mbox (mboxCreate) does on its own. Will hide the div until Target responds back: