Liveshop StreamAds - Polyfill Use Cases

This documentation is about how to you add Stream Ads is some specific cases that you can't use web components

  1. Put this code below near to the top of the tag and before any other script or CSS tags.
<script>
    var liveshopSdkWidgetOptions = {
      live: "PUT_YOUR_LIVE_URL_HERE" 
    };

    // Core Script (do not touch)
    (function (i, s, o, g, r, a, m) {
      var p = new Promise(function(rs){return rs();});
      a = s.createElement(o);
      m = s.getElementsByTagName(o)[0];
      a.async = 1;
      a.src = g;
      a.onload = function(){return p.then(function(){return ss(liveshopSdkWidgetOptions);});};
      m.parentNode.insertBefore(a, m);
    })(window, document, 'script', 'https://assets.streamshop.com.br/sdk/liveshop-web-sdk.min.js');
 </script>

Once your tag is inserted, you'll be able to call anytime the global function openStreamShopLive("PUT_YOUR_LIVE_URL_HERE"). It will open your live in a modal. (This command openStreamShopLive is a promise, and it's resolved when the live is closed by the user)


  1. The Streamshop ADS Iframe could be added anywhere in your site, use the following iframe tag
<iframe src="https://yourlive.com/ads" allow="fullscreen; autoplay; picture-in-picture"></iframe>

❗️

Attention to src attribute URL

When you access your live url, you just have to simply change loja to ads:

https://yourlive.com/loja

This url above will change to:

https://yourlive.com/ads

Then you put in your src iframe.


🎉 That's it! Enjoy your ADS 🎉

By default, the script will open the exact live/video that you pass in the src attribute of the iframe. If you want, you can change which live/video will be displayed when the user clicks by following the steps below

Example:

I want to put this live in Iframe https://live.streamshop.com.br/streamshop_example/loja

But when I click I want to show this target fullscreen url: https://live.streamshop.com.br/video/foobar

The final result would be:

<iframe src="https://live.streamshop.com.br/streamshop_example/ads?live=%3Chttps%3A%2F%2Flive.streamshop.com.br%2Fvideo%2Ffoobar%3E" allow="fullscreen; autoplay; picture-in-picture"></iframe>

Attention to 3 points:

  1. I changed /loja to /ads
  2. I encoded my Target URL in any encoder website like this one
  3. I passed my Target URL as a query parameter named live