Advice and answers from the MemberSpace Team

Javascript Hook Instructions

Warning: This guide is for people comfortable with Javascript programming.

We provide the ability for you to access the currently logged in member so that you can further customize your site. Common use cases include displaying certain elements if a member is logged in, pre fill forms with a member's information, and displaying personalized messages.

To use the javascript hook start by placing this code on your website:

<script>
  (function() {
    MemberSpace.onReady = MemberSpace.onReady || [];
    MemberSpace.onReady.push(function(args) {
      if (args.member) {
        // Your custom code goes here
      }
    });
  }());
</script>

The member object data structure will be as follows:

  {
    id: [integer],
    name: [string],
    firstName: [string],
    lastName: [string],
    email: [string],
    plans: [array],
    failedCard: [boolean]
  }

Property Descriptions

id

The member's unique identifier.

name

Simply a string combination of the first and last name of the member.

firstName

A string of the members first name.

lastName

A string of the members last name.

email

A string of the members email address.

plans

The plans array is a list of plan names the member is actively subscribed to.

failedCard

The failedCard boolean indicates if the customer currently has a failed payment.

Did this answer your question?