What are the methods used by Optimizely and Visual Website Optimizer to manage visual DOM editing?

Optimizely and Visual Website Optimizer are two innovative platforms that enable users to easily conduct A/B Testing.

One standout feature is their visual DOM editing capability, which allows users to visually alter a webpage and save the modifications for offline use. These changes are then implemented during a random visitor's page view by loading a JavaScript script.

What is the process behind the functionality of the visual editors?

Answer №1

Hi there, I'm Pete Koomen, one of the founders of Optimizely, and I can shed some light on how things work from our end. Let's imagine you have a website like and you want to run an experiment on it.

  1. Firstly, you may choose to include your Optimizely account snippet on that page, which will look something like this and remains constant:

    <script src="//cdn.optimizely.com/js/XXXXXX.js"></script>

  2. The Optimizely Editor loads in an iframe and uses window.postMessage to communicate with the page. This process only works if the page already has the snippet mentioned above. If not, the editor will time out while waiting for a message from the iframe page and will reload it through a proxy that adds the snippet. This loading method allows the editor to function with pages that have the snippet, don't have it, or are behind a firewall (which requires the snippet).

  3. At this stage, users can make changes to the page using the editor, such as altering text, changing images, or rearranging elements. Each change is recorded as a line of JavaScript like this:

    $j("img#hplogo").css({"width":254, "height":112});

    |__IDENTIFIER__||____________ACTION______________|

  4. Therefore, a "variation" of a page consists of JavaScript statements that produce the desired changes when executed. If you're interested, you can view and edit this code directly by clicking "Edit Code" in the Optimizely Editor's bottom right corner.

  5. Once you've added the account snippet to the page and initiated the experiment, the JavaScript file linked to by your snippet will assign each visitor to a bucket and execute the relevant JavaScript during page load.

Bucketing visitors and implementing changes promptly during page load involve more intricate processes, but this brief explanation should give you an overview!

Pete

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Remove the scrollbar from the iframe and instead display a scrollbar on the page in its place

Currently, I am facing an issue with the vertical scrollbar on an iframe. I want to remove it so that the scrollbar appears on the main page instead. This way, I will be able to scroll the content of the iframe using the page's scrollbar. I managed to ...

What steps can you take to fix the error message "Cannot read properties of undefined"?

There seems to be a warning that I've encountered: [Vue warn]: Error in render: "TypeError: Cannot read properties of undefined (reading 'nestedArray')" How can I resolve this issue? Here is my beforeCreate function: beforeCreat ...

I am experiencing difficulties with rendering highcharts to my div

I am currently working on integrating a highchart demo into a backbone.js widget. The HighChart Demo is not rendering properly within my widget, even though the template generates everything else correctly. It seems that there might be an issue with highc ...

Exploring various websites simultaneously using window.open

As a newcomer to javascript, I have encountered an issue with the window.open() method that I would like some help with. In my code, I take a user string, modify it in different ways, and then search for these variations. The intention is to open a new wi ...

Triggering a re-render in React

There are times when I find myself needing to trigger a re-render while still in the middle of executing a function. As a solution, I've developed a method using the state variable my_force_update. Basically, I change it to a random value when I want ...

Send the image URL to the JavaScript function

Is there a way to resolve the error I'm encountering when attempting to pass my uploaded photo to JavaScript on a page? werkzeug.routing.BuildError BuildError: ('uploaded_file', {'filename': u'user/user-1/scan.jpeg'}, N ...

The getStaticProps function will generate an object by fetching data from various URLs

Within my getStaticProps function in next js, I am faced with the challenge of fetching multiple dynamic URLs and exporting the results as props to the component. As these URLs are automatically generated, I do not know how many there will be to fetch. My ...

retrieve trackpoint information using OpenLayers

When displaying a map with a GPX track using OpenLayers 5.3, I noticed that the trackpoints default to a MultiLineString geometry type. The example provided in the GPX-example actually has a larger file size because all of the <trkpt> tags are duplic ...

Tips for identifying when a tab has been reopened following closure?

There seems to be a problem with the JS state where it changes but then reverts back to its original state when the tab is closed and restored using cmd/ctrl + shift + t. Typically, data is fetched from the server via ajax using Vue's mounted() lifec ...

Error: The parameter "callback" must be in the form of a function

Following a tutorial to upload images to Twitter using Node.js with Twit. Here is the code: function upload_random_image(){ console.log('Opening an image...'); var image_path = path.join(__dirname, '/random_cam/' + random_cam()), ...

JavaScriptCore now includes the loading of AMD modules

I am trying to incorporate a JavaScript module into JavascriptCore on iOS. To achieve this, I am fetching the file's text through a standard HTTP request on the iOS platform. Once I have obtained the entire string, I plan to parse it into the JSconte ...

React: Improve performance by optimizing the use of useContext to prevent unnecessary re-renders of the entire app or efficiently share data between components without causing all

In my app, I have a Header.tsx component that needs to be accessible on all pages and a Home.tsx component where most of the content resides. The Home.tsx component includes an intersectionObserver that utilizes the useContext hook (called homeLinks) to p ...

Automatically select all options in MUI Autocomplete by default

Is there a way to have all the values in the autocomplete drop down automatically selected by default when the page loads? I've been experimenting with this example but haven't found a solution yet. If you know how to achieve this, please share! ...

Angular: Identifier for Dropdown with Multiple Selection

I have recently set up a multi select dropdown with checkboxes by following the instructions provided in this post: https://github.com/NileshPatel17/ng-multiselect-dropdown This is how I implemented it: <div (mouseleave)="showDropDown = false" [class. ...

Display a preview window once the image has been chosen

I have created an image preview div to show the selected image's thumbnail. Everything was working fine so far. But now, I want this div to be hidden when the page initially loads and only become visible when a user selects an image to upload. Here is ...

Creating consistently sized rows of Bootstrap columns - with either equal heights or equal spacing between each row

It would be great if bootstrap had a built-in feature where it automatically assigns the wrapper div of any item with a height based on the height of the largest div. In this example on JSFiddle, you can see that I have different heights for the video-ite ...

Retrieving data from the array properties in a JSON object

I am facing a challenge with an array of elements, each element is quite complex as it contains nested arrays as properties. My goal is to extract specific attributes from these elements, but I have been struggling to achieve this using the forEach functio ...

The Angular JSONP feature is malfunctioning

I'm attempting to utilize a jsonp call with the following code, but it doesn't appear to be functioning as expected. Code var url = 'http://z:15957/Category/Categories?callback=JSON_CALLBACK'; $http.jsonp(url).success(function (data) ...

Steps for adding a React Class Component into a Modal that is not within the React Tree

Our project is built using PHP MVC Framework and we initially used jQuery as our main JavaScript framework for handling UI activities. However, we have now transitioned to using React.js. My query is about how to inject or append a React Functional/Class-b ...

The matter concerning the intricacies of Rails, JQuery, Prototype, and RJS

I am exploring the integration of Jquery and ajax in rails 3.0.7, but I'm unclear on the current landscape regarding their usage together. There seems to be an abundance of hacks, plugins, and scripts available for utilizing JQuery. So: Is there an ...