Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Пример ссылки: https://your-website.com/fitting-room?room= selected_room_uuid&product=product_vendor_code&open_visualizer=1

Expand
titleИнструкции
language
Code Block
js
<html>
<head></head>
<body>
<script type="application/javascript"
        defer
        src="https://wizart-filesd35so7k19vd0fx.fra1.cdn.digitaloceanspaces.comcloudfront.net/production/integration/floating-button.min.js">
</script>
<script type="application/javascript">
    document.addEventListener("DOMContentLoaded", function(event) {
        varconst paramsString = window.location.search; //get url params
        varconst searchParams = new URLSearchParams(paramsString); //parse url params


        varconst floatingButton = new window.WFloatingButton({
            token: "5sqE3XBME9tOTgZfc8bI5IxritvBLfwuJWU7txisyrliCpifqKRa7LHYJ7cz",
            element: document.getElementsByTagName("body")[0]
        });

        floatingButton.set({ vendorCode: searchParams.get('product') }); //a product vendor code from url params

        floatingButton.render({
            parameters: JSON.stringify({
                room_uuid: searchParams.get('room'), //a room uuid from url params
            })
        });
        
        // open Visualizer after page load
        if (searchParams.get('open_visualizer') === "1") {
          floatingButton.open();
        }
    });
</script>
</body>
</html>

...