Cross Domain tracking not working for HubL Markup and Membership Content
SOLVE
We deployed the private content and membership manager on our website, built on the HubSpot CMS. We ran into an issue where the login parameters are not working when checked in HubL. Specifically, I wanted to adjust menu items based on if the user is logged in or not. Below is the code.
On the main domain (www.domain.com), the HubL works as expected, substituting "Hi, {{First Name}}" for "Member Login" and adding in the extra links. But on our blog subdomain, (blog.domain.com), these if statements always return false, even when the user has logged in. I'm assuming this has to do with the way cookies are cached and checked when a user logs in, but it seems odd that it does not work across domains, considering the password protection is only based on lists and can be applied across domains. Is this intended behavior, and is there a workaround for this?
Cross Domain tracking not working for HubL Markup and Membership Content
SOLVE
Here's the reply I got from a Hubspot dev on this issue:
"This is currently by design because we don’t know if you want to share the login across domains. We default to the more secure option. We may expose this as an option in the future."
So, unfortunately, at this time the request_contact.list_membership work around is all that can be done.
Alyssa Wilie Web Developer
LyntonWeb
If this answer solved your question, please mark it as the solution.
And the preview shows only the menu based on the contact property.
The property value, I set as a CSS class that applies a display: block, to a contact that defaults to display: none.
Obs: This property that I created below is for example only. In this case you can rely on a property set after a contact completes a form, or other HubSpot action.
Cross Domain tracking not working for HubL Markup and Membership Content
SOLVE
From my understaing of Hubspot Membership the logged in state would only work on pages set to Private. Are there pages on your main domain not set to private where your is_logged_in is working? If not, a workaround you could use is just checking if the user is in the list being used for membership.
{% if "XXXX" in request_contact.list_memberships %}
<!-- logged in html -->
{% else %}
<!-- logged out html -->
{% endif %}
XXXX being the number ID of the list.
Alyssa Wilie Web Developer LyntonWeb
If this answer solved your question, please mark it as the solution.
Nov 25, 201911:39 AM - edited Nov 25, 201911:40 AM
Contributor
Cross Domain tracking not working for HubL Markup and Membership Content
SOLVE
Yes, it works on all pages on the main domain. I have a menu item that is only visible if members are logged in, and it works on all pages, which is why I was surprised it did not work across sub-domains. With that said, the list membership might be a good workaround, since private membership is tied to a particular list anyways and all our membership is tied to a single static list.
Either way, it would be good to know if list membership is meant to not be cross-domain, or if there is a way to make those tokens cross-domain.
Cross Domain tracking not working for HubL Markup and Membership Content
SOLVE
That is strange then why it wouldn't be working on the subdomain as the hubspotutk cookie does use a wildcard domain so as to encompass even subdomains. Do you have any landing/website pages on a subdomain where the variable won't work? Wondering if it's just an issue with blogs or the subdomain as a whole.
If this answer solved your question, please mark it as the solution.
Cross Domain tracking not working for HubL Markup and Membership Content
SOLVE
It's definitely the subdomain, as we use the blog tool to host press releases on domain.com/press-release and the menu works correctly with showing and hiding the menu items.
Cross Domain tracking not working for HubL Markup and Membership Content
SOLVE
Here's the reply I got from a Hubspot dev on this issue:
"This is currently by design because we don’t know if you want to share the login across domains. We default to the more secure option. We may expose this as an option in the future."
So, unfortunately, at this time the request_contact.list_membership work around is all that can be done.
Alyssa Wilie Web Developer
LyntonWeb
If this answer solved your question, please mark it as the solution.
Cross Domain tracking not working for HubL Markup and Membership Content
SOLVE
That both makes sense and is unfortunate. It's problematic as the workaround would apply styling even when they are not logged in, as long as the browser was cached as that person (an email on any submission form). In practice, the workaround should not have a large impact on the UX in this particular case, but would in cases where you want to display non-confidential, sensitive information (like subscription level) after someone has logged in.