Installation
Add the following Javascript script into your product to complete the Hubble SDK installation. The snippet can be added to every page where Hubble can be shown and used to track your users. Common places include the <head> of the website or at the end of the document right before the closing </body> tag.
<script async src="https://sdk.hubble.team/sdk/{teamId}.js" />
Show Surveys
In addition to triggering surveys automatically based on user navigation and actions, surveys can be manually shown through the Javascript SDK.
window.Hubble.show(id)
Where id is the ID of the survey. The ID can be easily found by looking at the URL when building a survey or looking at survey results e.g. https://app.hubble.team/surveys/id/build.
This can be useful if you need to programmatically show surveys that involve more complex user interactions or conditions than our builder currently provides.
Identify Users
Hubble's SDK allows you to identify users and assign custom attributes. Once a user is identified with a custom userId, you will be able to use the Hubble SDK to target specific user segments based on their specific attributes.
Hubble.identify(userId,{email: john@email.com, firstName: John, lastName: Apple, createdAt:123415 ... })
After sending the identification call, the user data table will be reflected real-time to include the newly identified user. You can use the filter on the top of the table to display users based on their attributes.
Please note that you can add additional user attributes. If you want to change the user's attributes, you can submit a new identify call with the additional attributes. Please note that existing attributes will not be removed; any existing attributes that you don't include in the new identification call will remain.
Track Events
Hubble's SDK also offers an events tracking system that allows you to track specific events and use them as triggers for custom surveys.
Hubble.track(eventName)
The events table will show all the events that you have added through the SDK. By default, you will be able to monitor the surveys that have been connected to each event.
Developer Support
Have any questions? For additional support, join Hubble's community Slack group!