Home > Customizations > Customer portal > Display contact widget only for customers logged in the customer portal

Display contact widget only for customers logged in the customer portal

Some of our customers wish to display live chat button or other contact widget in the Customer Portal only for customers, which previously logged in into the portal. This is a very easy task - please find the instructions below.

First of all we will need to prepare the first part of the code which we will be using to check if customer is logged in. We will be checking that via variable {$userLogged} saved in the parameter userLogged.

Please navigate into the Customer portal > Settings > Customize design > Design > Own HTML > Footer HTML

Here you can use following code snippet which will be cooperating with the contact widget integration code.

Footer HTML:

var userLogged='{$userLogged}';

The second step will be editing the contact widget integration code where we add a condition to review if customer is logged in. We will be doing that in Customer portal > Settings > Customize design > Tracking codes > Before </BODY>

Here is the code snippet to use. Pleas replace the YOURDOMAIN.ladesk.com with the your URL of your LiveAgent account and xxxxxxxx with the ID of your contact widget from the original integration code.

Before </BODY>:

<script type="text/javascript">
(function(d, src, c) { var t=d.scripts[d.scripts.length - 1],s=d.createElement('script');s.id='la_x2s6df8d';s.async=true;s.src=src;s.onload=s.onreadystatechange=function(){var rs=this.readyState;if(rs&&(rs!='complete')&&(rs!='loaded')){return;}c(this);};t.parentElement.insertBefore(s,t.nextSibling);})(document,
function(e){ LiveAgent.createButton('xxxxxxxx', e); });

Once you save your work, you are done. Feel free to check out customer portal and see contact widget only once you log in into the portal.

Ready to try LiveAgent?

It's free for the first 14 days! No credit card required.

Get Started
We work well with others...
Magento Joomla Wordpress Mailchimp
Contact us


+1-800-811-6590 (Toll Free in USA & Canada)

+421 2 33 456 826 (European Union & Worldwide)

Quality Unit, LLC 616 Corporate Way, Suite 2-3278 Valley Cottage, NY 10989

Stay in touch
Blog Google+
© 2004-2020 LiveAgent.com, All rights reserved