By default Helppier code snippet is injected in a main layout and in this way it is automatically added to all pages of a website/webapplication and for all users.
If you want to remove the widget from one or several page you need to change the code snippet by adding a condition to test current url.
Below you can see an example of add Helppier in all pages except the login page ("/login").
In blue what was added so the widget is not added to the login page):
<script type="text/javascript">
// don't show Helppier at "/"
function CheckSlugValidity(slug){ return slug.indexOf(window.location.pathname) == 0;}
if(CheckSlugValidity("/login")) {return false}
// your code snippet.
window.help_company_key = 'xxxxxxxxxxxxxxxxxx';
window.helppier_app_id = 'yyyyyyyyyyyyyyyy';
var script = document.createElement('script');
script.setAttribute('id', 'helppierEmbed');
script.setAttribute('defer', '');
script.setAttribute('src', 'https://km.helppier.com/widget/js/start.js?help_company_key=' + window.help_company_key);
document.head.appendChild(script);
</script>
The same can be done to not show Helppier for a set of users.
Below you can see an example of add Helppier for all users except the oner that are admins.
In blue what was added so the widget is not added for these type of users.
<script type="text/javascript">
// example of getting the user type from database in C#.
var userType = "<%= UserType %>";
// don't show Helppier for admin users
function CheckIsAdmin(userType){ return userType == "admin";};
if(CheckIsAdmin(userType)) {return false};
// your code snippet.
window.help_company_key = 'xxxxxxxxxxxxxxxxxx';
window.helppier_app_id = 'yyyyyyyyyyyyyyyy';
var script = document.createElement('script');
script.setAttribute('id', 'helppierEmbed');
script.setAttribute('defer', '');
script.setAttribute('src', 'https://km.helppier.com/widget/js/start.js?help_company_key=' + window.help_company_key);
document.head.appendChild(script);
</script>
Comments
0 comments
Please sign in to leave a comment.