Controlling click actions on the Shoplive plugin campaign list

    Controlling click actions on the Shoplive plugin campaign list


    Article summary

    Here is an example of overriding messageCallback to manually control the click action on the campaign list in the Shoplive Plugin.

    ON_CLICK_CAMPAIGN_LIST_ITEM

    <script type="text/javascript" src="https://static.shoplive.cloud/shoplive.js"></script>
    <script>
      var messageCallback = {
        ON_CLICK_CAMPAIGN_LIST_ITEM: function(payload) {
          var campaign = payload.campaign;
          var ak = payload.ak;
          console.log('Campaign info : ', campaign);
          // show player modal
          cloud.shoplive.showFeaturedPlayerModal(campaignKey:campaign.campaignKey);
        }
      };
      cloud.shoplive.init({ accessKey: 'YOUR_ACCESS_KEY', messageCallback: messageCallback });
    </script>
    
    
    <div id="shoplive-overall"></div>
    <script defer>
      cloud.shoplive.setOverall('shoplive-overall');
    </script>