Getting Member Information - SSR

In Server Side Rendering scenarios where you have access to the whole DOM, you can subscribe to our custom events before the widget even starts to load. In this case there is no risk of missing the initial event(s).

const handleReady = ({ detail }) => {
  // Your code
};        

document.addEventListener('MemberSpace.ready', handleReady);


const handleMemberInfo = ({ detail }) => {
  // Your code
};

document.addEventListener('MemberSpace.member.info', handleMemberInfo);


//MS install code ... Please see the relevant section
var MemberSpace = window.MemberSpace || {subdomain: "YOUR_SUBDOMAIN"};
(function(d){
  var s = d.createElement("script");
  s.src = "https://cdn.memberspace.com/scripts/widgets.js";
  var e = d.getElementsByTagName("script")[0];
  e.parentNode.insertBefore(s,e);
}(document));

Please check out the Install Code section also.

Last updated