Show content based on what user has clicked before
SOLVE
Hi there!
This question might have multiple answers, I'm just looking for some ideas for how to achieve the following –
If a user enters our site and dismisses a popup/modal, is there a way to have Hubspot remember this and not show the popup/modal next time?
I know that Hubspot has productized this into the 'lead flow' feature, but those popups can't really be customized (and add lots of poorly structured CSS to the page). There could also be other uses for this, like showing/hiding sections of a page based on clicks on a previous page.
Show content based on what user has clicked before
SOLVE
You need a cookies.
You can:
1. add a cookie to the users browser set to a boolean, true or false, and if the user closes the modal you would set the cookie to the opposite of what it was initially, let's say true, and your show condition for the modal would state "if cookie in question is false, show modal" so that if the cookie is set to true it would not show.
2. you could set the cookie to a date/time stamp then your show condition for the modal could do some math to test if the date/time is more than X number of days old, that way you could continue showing the modal to the user after 30 or so days automatically.
if a user ever clears their cookies it would remove yours as well and reset your functions.
I haven't played with javascript cookies, but that is all Hubspot leaves you with options wise so let us know if it works for you. Here's an example" https://www.w3schools.com/js/js_cookies.asp
Show content based on what user has clicked before
SOLVE
You need a cookies.
You can:
1. add a cookie to the users browser set to a boolean, true or false, and if the user closes the modal you would set the cookie to the opposite of what it was initially, let's say true, and your show condition for the modal would state "if cookie in question is false, show modal" so that if the cookie is set to true it would not show.
2. you could set the cookie to a date/time stamp then your show condition for the modal could do some math to test if the date/time is more than X number of days old, that way you could continue showing the modal to the user after 30 or so days automatically.
if a user ever clears their cookies it would remove yours as well and reset your functions.
I haven't played with javascript cookies, but that is all Hubspot leaves you with options wise so let us know if it works for you. Here's an example" https://www.w3schools.com/js/js_cookies.asp
Show content based on what user has clicked before
SOLVE
Thank you Jsum!
Follow-up question – Hubspot leaves creates its own cookie on the user's machine – is there a way to add to this existing cookie? Or do I have to create a brand new one just for the functionality I'm creating?
May 16, 20183:42 AM - edited May 16, 20183:46 AM
Key Advisor
Show content based on what user has clicked before
SOLVE
I'm no expert on cookies. You can see cookies in the Application section of your developers console. You can look through the cookies applied to the user by your site, but I don't think you will find anything useful for what you are trying to accomplish, Hubspot's cookies seam to be heavily encrypted. You should be able to create your own cookies though, which would be added to the list of cookies in the area I mentioned.
**Edit: I did a little test. In the javascript console I entered document.cookie = "username=John Doe"; then checked the cookies in the application section of the console and a new cookie, "username" with a value of "John Doe" was there. I refreshed the page and the cookies still exists. set the cookie to the HubL variable for date/time and you can hide the modal on a timer, say 30 days. it will work.