Sometimes websites need functionality that goes beyond standard modules or page settings. HubSpot Content Hub provides custom code features that allow developers to add scripts and advanced code snippets to the website.
These scripts can be used for analytics, integrations, tracking pixels, or custom functionality that enhances the website experience.
Understanding how HubSpot Content Hub scripts and custom code features work helps teams extend the capabilities of their website while maintaining a structured development environment.
Custom code refers to scripts or code snippets that are added to a website to provide additional functionality.
Common examples include:
Custom code allows websites to connect with external services and track visitor activity.
HubSpot provides multiple locations where scripts and custom code can be added.
These include:
Each location serves different purposes depending on where the script needs to run.
Many tools require scripts to run on every page of the website.
To add site-wide scripts in HubSpot Content Hub:
Once saved, the script will load across all pages of the website.
Sometimes scripts are only needed on specific pages.
In these cases, scripts can be added directly to page settings.
To add page-level scripts:
This ensures the script runs only on that page.
Many businesses use scripts to track visitor behavior.
Examples include:
These scripts help measure website performance and visitor interactions.
HubSpot Content Hub allows developers and marketers to add custom scripts that extend website functionality and integrate with external tools. By using site-wide or page-specific code settings, teams can implement analytics tracking, integrations, and interactive features while maintaining control over the website environment.