top of page

[SHORT] How to send data to custom code from Velo

This is a quick reply to a question that has been asked on Velo's discord.

Sometimes we need to use libraries in our project that are not supported by Wix. In this case, we need to use custom code to embed third-party code into our Wix website.

The problem is that this code sit "outside" of Velo, therefore we cannot call it from our code. The solution is to post messages from the Velo environment to our custom code.

We do that by using postMessage from the `wix-window` Module.

import {postMessage} from 'wix-window'

$w.onReady(function () {
    postMessage("page is ready");

In our custom code panel, we add a script tag to handle the message emitted by Velo.

<script>"setting listenner");
    window.addEventListener("message", (event) => {
        if(event.origin !== ""){
        console.log("new message",
    }, false);

With this setup, we are able to listen and react to events happening within Velo. This is especially useful when working with external SAAS and other tracking tools.


24 views0 comments

Recent Posts

See All
Anchor 1

Need help with Velo ?

We provide tutoring and debugging session to all skills levels.

From amateurs to professional developers, help writing high-quality code for performance and security

Maybe later