Skip to main content
All Collections GrowthBooster
Adding the GrowthBooster widget to the Wix website
Adding the GrowthBooster widget to the Wix website

How to add the GrowthBooster widget to any given place of your Wix website.

S
Written by Sebastian Donnelly
Updated over a month ago

We assume that you have already configured your GrowthBooster JS widget and now you want to add it to your Wix website.

  1. Go to https://users.wix.com/signin and sign in with your administrator credentials.

  2. Select your website on the "Sites" page and click on the "Select & Edit site" button.

  3. You will be redirected to your website dashboard. Click "Settings" in the side menu to the left.

  4. Scroll down to the "Advanced" section, and click the "Custom code" button.

  5. On the "Custom Code" page click the "Add Custom Code" button.

  6. Copy this code

        <script
    id="gb_widget_script"
    type="module"
    src="https://locations.linda.co/gb-widget.js"
    data-skip-autostart>
    </script>

    <script>
    window.initGeoboosterWidget = (config) => {
    if (!window.GeoboosterWidgetInterface) {
    console.error('GB-WIDGET: no geobooster script found on page')
    return
    }

    const currentWidgetVueApp = GeoboosterWidgetInterface.vueApp()

    if (currentWidgetVueApp) {
    currentWidgetVueApp.unmount()
    }

    const initialWidgetConfig = {
    widgetToken: '', // your widget token over here
    containerId: 'gb-widget' // id of the element you want widget to be mounted in
    }

    GeoboosterWidgetInterface.start(initialWidgetConfig)

    setTimeout(() => {
    // for some reason, refetch doesn't happen when we change the page of the WIX site
    // unless we do it like that (manually)
    GeoboosterWidgetInterface.refetch()
    }, 1000)
    }

    if (
    document.readyState === 'complete' ||
    document.readyState === 'loaded' ||
    document.readyState === 'interactive'
    ) {
    window.initGeoboosterWidget()
    } else {
    document.addEventListener('DOMContentLoaded', () => {
    window.initGeoboosterWidget()
    })
    }
    </script>
  7. Paste it into some text editor on your computer

  8. Return to Linda, go to GrowthBooster->Widgets, click on your widget, go to the "Embed code" section, and copy data-widget-token value from the widget code snippet.

  9. Paste the data-widget-token value into the script from the step 6.

  10. Copy the modified script.

  11. Return to Wix and paste it into the textarea on the "Add custom code" dialog, specify the name of the snippet (for example, GB Widget), select the page to add the widget to, and place to add the widget code, we used "Body - end" here.
    Note: for one widget you need to create one custom code, so if you use the same widget on different pages you need only one custom code.

  12. Click the "Apply" button.

  13. Click the "Site & App"->"Website" in the side menu to the left.

  14. Click the "Edit Site" button.

  15. Wix editor opens. Select the page you want to add the widget to from the dropdown.

  16. Add a new blank section to the website layout where you want to add the widget: click the "+ Add Section" button, then select the "+ Blank Section" in the side menu.

  17. Click the "Add Elements" button in the toolbar.

  18. Select "Embed Code"->"Custom"->"Custom Element".

  19. A new custom element will be added to the website layout. Please adjust its size if you need to.

  20. Click the "Set Attributes" button.

  21. The "Element Attributes" dialog opens. Click the "Set Attributes" button.

  22. Set "Attribute name" equal to id and "Value" equal to gb-widget, then click the "Set" button.

  23. Click the "Choose Source" button.

  24. The "Element Attributes" dialog opens. Scroll it down, set the "Tag name" equal to gb-widget then press "Enter" and close the dialog.

  25. Click the "Save" button in the top toolbar, then the "Publish" one.

  26. Congratulations! You've successfully embedded the GrowthBooster widget into your website.





Did this answer your question?