wf.onVariationRecorded()Registers a callback function that executes whenever a variation runs successfully on your page. This is useful for integrating Webflow Optimize’s experiment data with external analytics services.
Before using this method, make sure you’ve created and published at least one variation in Webflow.
function(result): function - A callback function that receives a result object containing information about the variation.
The callback function will only trigger for variations that run after it has been registered on the page.
A success callback which includes the results of the successful variation.
Object properties
When should you call onVariationRecorded()?
To make sure your callback fires, call onVariationRecorded() as early as possible to guarantee it’s registered before Webflow returns any recorded variations. Preferably, before the DOM starts rendering. This prevents the callback from missing any variations. To illustrate:

We recommend adding the API call in before the closing </head> tag of your site or page using Webflow’s Custom Code feature. Or, if using a tool like Google Tag Manager, add the API call when configuring the tag.
A variation is considered recorded when the page loads and the variation has been displayed to the user. You can review the full logic that leads up to a recorded variation in this help article. A simplified version of the logic is as follows:
Each time a variation is recorded, the callback fires. You may have multiple variations on a page, so the callback will fire once for each variation.