Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.






                // Function to handle the data sending to another platform
function sendDataToPlatform(data) {
    if (typeof clarity === "function") {
        data.forEach(item => {
            clarity("set", "Exp_Name", item.expName);
            clarity("set", "Var_Name", item.varName);
            console.log("Sent data to platform: Exp_Name =", item.expName, "Var_Name =", item.varName);
    } else {
        console.error("Clarity function is not available.");

// Function to check if a library (e.g., Clarity) is loaded, with a timeout
function whenAvailable(name, callback) {
    const maxTime = 150 * 1000; // Maximum time to wait in milliseconds (2.5 minutes)
    const interval = 100; // Poll every 100 milliseconds
    let elapsedTime = 0; // Track the elapsed time

    var intervalId = setInterval(function() {
        if (window[name]) {
        } else if (elapsedTime > maxTime) {
            console.error(name + " library did not load in time.");
        elapsedTime += interval;
    }, interval);

// Convert snippet lifecycle hook for experiences evaluated
window._conv_q = window._conv_q || [];
    what: 'addListener',
    params: {
        event: 'snippet.experiences_evaluated',
        handler: () => {
            console.log("All experiments have been evaluated");

            // Prepare the data for each experiment and variation
            const allData = Object.keys(convert.currentData.experiences).map(expId => {
                const expData = convert.currentData.experiences[expId];
                const variation = expData.variation;
                let experimentName = => === expId)?.name || 'Unknown Experiment';
                return { expName: experimentName, varName: };

            // Wait for the Clarity library to be available
            whenAvailable('clarity', function() {
                // Once Clarity is available, process and send data