Memberships

Last updated:
APPLICABLE PRODUCTS
  • CMS Hub
    • Enterprise

Memberships is a feature that makes it possible to require visitors to have an account in order to access content. The account system leverages the HubSpot CRM and CRM Lists together with the ability for a visitor to create a password for their account. Marketers can easily create pages on their sites that only contacts on specific lists in the CRM can access.  You can additionally restrict access to knowledge base articles and blogs using memberships.

Membership user flow

When contacts are granted access to content, which can occur when they join lists or though manual assignment, they are sent an email to register for your website, where they set a password to access content they have permission to access. 

Imagine a gym, which wishes to allow visitors to register for classes and view the classes they have registered for. When a visitor registers for a class, the form submission creates a contact in the HubSpot CRM and that contact is added to a list based on the form submission, which is used to grant access to a "My Events" page. 

An example gym registration.

The visitor receives a membership registration email that allows them to create a password for their membership account. 

Registration form

Now, when the visitors log in to their account, the user can log in to the private "My Events" page using the email and password they set. Because the visitor is logged in, the developer who created the private content can render data about the logged in contact using data from the CRM. 

A visitor uses their account to log in and see classes they registered for.

 

Membership HubL variables

For some businesses, it may make sense to show different content based on if a user is signed in or not. There are HubL variables which developers can use to check to see if a contact is currently logged in on a website.

The HubL variable request_contact.is_logged_in indicates if the current visitor is signed in to the website through memberships. It can be used within an if statement to conditionally render certain content, allowing you to individually cater your visitor's experience.

{% if request_contact.is_logged_in %} You're signed in! {% else %} <a href="/_hcms/mem/login">Log In</a> {% endif %}

If you want to display different content on the same page based on list membership, you can check the signed-in contacts list memberships using request_contact.list_memberships HubL variable, which returns a dict of list IDs the logged in contact is a member of.

To personalize content without using memberships, you can use the contact variable if a visitor has submitted a form on your website.

CRM object HubL functions

In addition to general content displayed conditionally on a page, it’s possible to pull information about objects within your HubSpot account such as Contacts/Companies/Deals/Products using the functions:

For security purposes, only product and marketing event objects can be retrieved on a publicly accessible page; to pull information about other object types, a page must be behind membership. 

{% if request_contact.is_logged_in %} {% set membership_contact = crm_object('contact', request.contact.contact_vid, 'firstname,lastname') %} Welcome back, {{ membership_contact.firstname }} {{ membership_contact.lastname }} {% else %} <a href="/_hcms/mem/login">Log In</a> {% endif %}

Register, login, and log out

When a contact is granted access to any content on your website through memberships, they will receive an email to register for your website where they can set a password to access content they have permission to view. In the event you need to resend a contact a link to register, you can resend their registration email.

The URL paths for user sign-in/out are consistent for all HubSpot CMS sites with the membership functionality.

  • <your domain>/_hcms/mem/login
  • <your domain>/_hcms/mem/logout

When a visitor logs in to their website, a cookie is sent to their browser, allowing them to browse through your website and access pages they have access to through memberships without having to log in again. If a visitor logs out, or has never logged in to your website in their browser, they will be prompted to log in before being able to view the content.

Membership templates

Sites with memberships have a few special pages that are needed to facilitate the memberships functionality. These are dictated by special system templates. These system templates are editable, allowing you to control the look and feel of the various membership steps. To set which templates you are using, go to Settings > Private Content and choose the "Templates" tab. To create a template to set in these settings, go to Marketing > Files and Templates > Design Tools, then in the top left click File > New File > HTML & HUBL and select the appropriate Template Type from the dropdown. 

For a comprehensive list of the membership templates, refer to the membership section of the templates documentation

Only HTML + HubL templates can be membership templates.

Membership audit logging

In Settings > Private Content, you can view an audit log of what visitors have been interacting with content behind memberships. This allows you to see which visitors are viewing private content.

Audit log of private content viewership

SSO for Memberships

You can also manage all of your businesses access permission and authentication needs in a single system with Single Sign-on (SSO) for Memberships.

Social logins

You can provide users in your list a way to sign in using Google or Facebook instead of entering their email address and password. The social login provider sends the email address associated with the logged in social account. That email address is then used to validate if that contact is in a contact list with access to the content. This feature does not require you to have configured SSO settings. 

You need to have a page set to "Private registration required" with a contact list. Additionally your login template needs to have the membership_social_logins module.

Add social login to your membership pages


Was this article helpful?
This form is used for documentation feedback only. Learn how to get help with HubSpot.