Is it possible to display contact value in hubspot website


#1

I am looking for displaying contact value in hubspot website https://www.bigpictureloans.com/loan-tracker

Basically, when we enter customer’s email, we want to get and display customer’s first name, last name and so. However, when I tried to use https://api.hubapi.com/contacts/v1/contact/email/testingapis@hubspot.com/profile?hapikey=demo to get json value, it won’t get me any value when I use the following code:

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
  <script type="text/javascript">
function getJSONP(){
   console.log("getJSONP....");
  $.ajax({
    type: "get",
    async: false,
    url: "https://api.hubapi.com/contacts/v1/contact/email/xxx/profile?hapikey=xxx&propertyMode=value_only&callback=?",
    dataType: "jsonp",
    jsonp:"callback",
     success:function(json,textStatus){    
       console.log("jsonp.success:"+json);    
   }, 
    error:function(XMLHttpRequest,textStatus,errorThrown){    
       console.log("jsonp.error:"+textStatus);    
   }    
   });
 
}
  </script>

Is there any way to display contact value in hubspot webpage?

Thanks advanced for any help.


#2

HI @wlyu9248,

This is available out of the box on any HubSpot hosted pages using personalization tokens. No API calls needed. Here is a step by step guide on how to add them to your page https://knowledge.hubspot.com/articles/kcs_article/cos-pages-editor/is-it-possible-to-add-personalization-tokens-to-landing-page

-Zack


#4

Thanks zwolfson for pointing me to the right direction. I wonder if contact value (personalization tokens) can be comparable. It seems personalization tokens generate an image element. Can the value be compared by javascript or jquery, or other methods that identifies contact value as var element? For specific, I want to achieve something like the following script:

  <script type="text/javascript">
      var approved={{contact.fund_approved}}
      if (approved)
          alert("Congratulations, your fund is approved"}
      else
          alert("Sorry, your fund is declined"}
  </script>

Thanks again


#5

@wlyu9248, personalization tokens will just show whatever the value of the contact property, it shouldn’t be an image. You definitely could use personalization tokens as you are in the example code you posted.

-Zack