Widget Integration
Learn how to integrate Hum into your website using our widget
Adding Hum to Your Website
The Hum widget provides a seamless way to integrate internet service provider discovery into your website. With just a few lines of code, you can add a fully functional internet service search interface to your site.
Overview
The Hum widget is a JavaScript component that can be embedded into any web page. It provides a seamless interface for users to:
- Check internet service availability at their address
- View available plans and pricing
- Order internet service directly through the widget
Installation
1. Add the Widget Container
First, add a container div with a specific ID where the widget will be rendered:
2. Add the Widget Script
Add the Hum widget script to your HTML page:
3. Initialize the Widget
After adding the script, you’ll need to initialize the Hum widget instance inside a script tag with your API key and container element:
The campaignId
parameter is optional and will be passed to the API and embedded in UTM parameters sent to the providers. This allows for tracking and attribution of widget interactions to specific marketing campaigns or sources.
Widget Layout Options
The Hum widget supports two different layout modes that can be configured during initialization:
Card Layout
The card layout provides a more engaging, user-friendly interface. This is ideal for:
- Consumer-facing applications
- Websites focused on user experience
- Applications where visual appeal is important
Summary Layout
The summary layout presents available internet service options in a clean, tabular format. This is ideal for:
- Quick comparison of plans and pricing
- Displaying multiple providers in a compact space
- Technical or business-focused applications
To specify the layout mode and campaign ID, pass a configuration object during initialization:
If no layout is specified, the widget will default to the card layout.
Address Data Format
The widget expects address data in a specific JSON format. Here’s the structure with explanations for each field:
Field Descriptions
- street1: The primary street address. This is required and should contain the street number and name.
- street2: Optional secondary address information. Use this for apartment numbers, suite numbers, or any additional address details.
- city: The city name. Required field.
- state: Two-letter state code (e.g., “MI” for Michigan). Required field.
- zip: The ZIP code. Required field.
- campaign_id: Optional identifier for tracking purposes. Can be used to associate the widget interaction with specific marketing campaigns or sources. This campaign_id will be embedded in the UTM parameters sent to the ISP and will be available in your Hum tracking.
Integration Examples
Example 1: Form-Based Integration
Here’s an example of how to integrate the widget with an HTML form if you have an address form on your website:
Example 2: Direct JSON Bundle Integration
You can also pass the address data directly as a JSON bundle without using a form:
Address Validation
The widget uses the same address validation rules as the API:
-
Required fields:
- street1 (primary address)
- city
- state (2-letter code)
- zip (5 or 9 digits)
-
Optional fields:
- street2 (unit/apartment)
- campaign_id (tracking)
-
Validation rules:
- State must be a valid US state code
- ZIP must be in 12345 or 12345-6789 format
- Address must be geocodable
- Address must be serviceable
Troubleshooting
If you encounter issues with the widget:
- Verify that the address data is properly formatted
- Check that the container div with ID ‘hum-widget’ exists on the page (or matches the ID you assign to the containing div)
- Verify that your API key is valid
- Check the browser console for error messages
Next Steps
- See the widget in action on our the Hum website at letshum.com
For additional support, contact support@letshum.com.