Displaying quantity of subscribers

SOLVE
Highlighted
Regular Contributor

Is there any way to display on a landing page the number of subscribers to a current list?  The goal of the landing page is to have people subscribe to the list and I'd like them to see that there are already xxx subscribers.

Anyway to automatically update that number from the actual total of list subscribers?

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Regular Advisor

 Hi @iamathlete,

 

Yes there is other option for this, Instead of passing hapikey as per our previous answer you need to pass access_token,  this is link to generate access token to in your portal.

But it is bit longer one solution.

 

For more detail about authentication process in HubSpot please refer HubSpot Authentication Overview link.

 

And Yes @Jimmy, you are right thanks for your suggestion on this.

 

TRooInbound Team

For more help and solutions, please visit at www.trooinbound.com or email at hello@trooinbound.com

 

Reply
0 Upvotes
6 Replies 6
Regular Advisor

Hi @iamathlete,

 

Yes, you can display number of subscribers of particular list by AJAX, All you need to do is make AJAX call. Below is code provided you just need to replace your list id and your HubSpot API key, if you are not aware from where you get your hubspot api key, here is link to Get Hubspot API-key.

 

 

<script>
  $(document).ready( function(){
    var listId = <Your list id>;
    var apiKey = '<Your HubSpot API key>'

    $.ajax({
      type:"GET",
      url:"https://api.hubapi.com/contacts/v1/lists/" + listId +"?hapikey=" + apiKey,
      success:function(data){
        alert('Total size of the list is ' + data.metaData.size);
      }
    });
  });
</script>

Note: We just alert your list count value, If you are not familiar with this method please provide your page link in which you need to show list count, so we can assist you as per the link provided by you.

 

We hope it resolve your query.

Did my post help answer your query? Help the Community by marking it as a solution.

TRooInbound Team

For more help and solutions, please visit at www.trooinbound.com or email at hello@trooinbound.com

Reply
0 Upvotes
Occasional Contributor | Diamond Partner

I won't recommand to use API key like that because everyboby will have access to it (if we inspect your code).

Remember that with your API key I can do what ever I want with what you have in your database !

 

Regular Contributor

Thanks TRooInbound for the suggestion.  I'd do it in a second but agree with Jimmy... I really don't want to post my unencrypted API key there.... Hmmmm... any other thoughts?

Reply
0 Upvotes
Regular Advisor

 Hi @iamathlete,

 

Yes there is other option for this, Instead of passing hapikey as per our previous answer you need to pass access_token,  this is link to generate access token to in your portal.

But it is bit longer one solution.

 

For more detail about authentication process in HubSpot please refer HubSpot Authentication Overview link.

 

And Yes @Jimmy, you are right thanks for your suggestion on this.

 

TRooInbound Team

For more help and solutions, please visit at www.trooinbound.com or email at hello@trooinbound.com

 

Reply
0 Upvotes
Regular Contributor

Thanks @TRooInbound!  

 

Hugely helpful.

 

New Contributor

Is this option with the access token possible on a landing page built in Hubspot? 

 

I really wish there was an easier solution to this.

Reply
0 Upvotes