PDA

View Full Version : Inject Javascript in Header Ad HTML Module


marianoaran
06-26-2013, 10:49 AM
I'm trying to incorporate a chat tool (Zopim) in my forum so the admin can talk to users that need help.

I'm putting this code in the "Header Ad HTML Module" and the chat tool loads correctly and works fine.


<script type="text/javascript">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8');
$.src='//cdn.zopim.com/?XXXXXXXXXXXXXXXXXXXXXXX';z.t=+new Date;$.
type='text/javascript';e.parentNode.insertBefore($,e)})(docum ent,'script');
</script>


Now, I would like the chat tool to pick up the logged in username and email address automatically. The tech people from Zopim told me to add this code to the previous:



<script type="text/javascript">

$zopim(function() {
$zopim.livechat.setName('Logged in name');
$zopim.livechat.setEmail('user@somewhere.com');
});

</script>





Can someone help me telling me what are the variables for 'Logged in name' and 'user@somewhere.com', so it picks it up from the DB?

Thanks!