Showing or hiding Pathmonk for logged-in visitors
If your website has a login, you may not want micro-experiences to show to people who are already customers and are working in your product, where they get in the way. You can tell Pathmonk when a visitor logs in and when they log out, with a CSS class or with a JavaScript function. Both need the Pathmonk snippet on the page.
Option 1: add a CSS class
Add the class to your login and logout buttons. Pathmonk reacts to the click on desktop and to the tap on mobile.
| CSS class | What it does |
|---|---|
pathmonkLogInUser | Stops showing micro-experiences to that visitor |
pathmonkLogOutUser | Shows micro-experiences again |
Example:
<button class="pathmonkLogInUser">Log in</button>
<button class="pathmonkLogOutUser">Log out</button>
If the button already has classes, add the Pathmonk class to them.
Option 2: call a JavaScript function
| JavaScript | What it does |
|---|---|
Pathmonk.logInUser(); | Stops showing micro-experiences to that visitor |
Pathmonk.logOutUser(); | Shows micro-experiences again |
Call it from your own code, for example when your login succeeds:
<script>
if (window.Pathmonk) { Pathmonk.logInUser(); }
</script>
Or put it in a link:
<a href="javascript:Pathmonk.logInUser()">Log in</a>
The names are case sensitive: logInUser and logOutUser, with a capital I, O and U.
Check that it works
- Publish the change on your website.
- Log in. Micro-experiences should stop showing while you browse.
- Log out. Micro-experiences should show again as usual.
If nothing changes, check that the Pathmonk snippet is on the page and that the class or function is spelled exactly as above. See Is Pathmonk not connecting to your website?.
Other ways to keep Pathmonk off parts of your site
- To keep Pathmonk off whole sections, such as your app or your account area, see Including and excluding pages.
- To keep it from your own team, see Hiding micro-experiences from your own team.
- To control the snippet itself, see How to control where the Pathmonk snippet fires using GTM.
- To open a goal from your own buttons, see Opening a conversion goal from any link or button.
