Calling User Data in Javascript

We’re trying to set up Intercom in our call using the following code;

    window.intercomSettings = {
    app_id: "qyau07fy",    
    user_id: user._id,
    user_hash: user.hmac_text,
    name: user.full_name_text,
    first_name: user.first_name1_text,
    last_name: user.last_name1_text,
    wedding_date: user.wedding_date_date

<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();</script>

I realize user is not the correct way to call a user’s information, however, I cannot find how to call the information.

Does anyone have insight on this? Need the ability call it from the header script.


You can create an HTML element on your Bubble page and past your Javascript code in there.
When ever you want access to the users data you can click on the Insert Dynamic Content button to get access to the Current User’s data
If your example you wanted to pass the user’s email to your Javascript function you would do something like.

user_email: Current User's email

You can similarly do the same for all the other user fields.


In this case we want the javascript in the header universally, therefore, we need a way to call via javascript.

Thank you for this work around!

@emmanuel any tips here?

This link explains how to add HTML content to the header (Since you want to add Javascript make sure you use the script tag)

From what I recall though the best way to do it universally would be to create a Bubble plugin and put it in there
To do so you will need to open the Plugin editor of your newly created Bubble plugin…you will then see a Shared tab which has a place to enter the HTML Header (Make sure to add your Javascript within a script tag) and if I am not mistaken this HTML gets added to all your pages by default. Also remember to install the newly created Bubble plugin to your app.


EDIT: I just realized you can not have dynamic content added via in the Bubble plugin method…
I think you will need to use something along the lines of a “Reusable Header Element” to get what you are wanting…not sure though.

@eve @romanmg any tips here?