OK, I do have a follow up question in the end. It’s looking likely this will be the last one if I can get it to work.
VWO requires that you edit the page from the outside, in its own interface separate to WordPress. This means that you can change all the text and images that it sees, appropriate to the visual or text differences of a particular test group. You cannot however edit the button code, as that is hidden to the outside.
This isn’t a huge problem if I can just get a variable to be sent from one interface to the other. You can edit HTML within their interface, so I tried to use the little PHP I know to implement
<?php $group=1 ?>
or
<?php $group=2 ?>
at the start of the page, and then just call this variable within the button code in WordPress and that will help me get a particular goal as
http://mysite.com/thank-you?group="<?php echo $group ?>"
, so I know I could add this variable into the URL too.
But the problem is that their interface supports javascript API code but NOT PHP code. Their default javascript code to be edited is:
<script type='text/javascript'>
// The following API function is called just before a variation is inserted. The variation is passed to the function as a (wrapped up) DOM element. Control is a DOM element on the page which will be replaced by the variation. Remove all comments here for faster loading tests.
_vwo_api_section_callback[VWO_SECTION_ID] = function(variation, control)
{
// jQuery is available as shorthand vwo_$. Example: vwo_$(variation).css('font-size', 'larger');
// INSERT YOUR CODE HERE
}
</script>
Is there some way to allow Javascript and PHP to play together nicely? i.e. create a variable within Javascript on their interface, but call it in PHP on my interface so that I can add it into the URL?
My other question is this (because I’m not so great with coding as you may have guessed). Will that variable only be stored for that user while they are on that page, or can it stay with them for their current session? There are 3 pages for them to look at, each one with buy buttons, and I want to make sure they are clicking the buy button appropriate to their goal group.
I’m pretty sure this is the very last hurdle for me to get over and then I can have a fully operational A/B test!
-
This reply was modified 4 years, 5 months ago by
Benny Lewis.