How to Load Script on One Domain and Exclude Previews in HubSpot [HubL Snippet]


How to Load Script on One Domain and Exclude Previews in HubSpot [HubL Snippet]

The HubL code below will help you scope heatmap or anlytics tracking on one domain and exclude any previews.


{% if request.domain == 'www.yourdomain.com' and request.query is not string_containing 'hs_preview' %}

{% endif %}

About the Author

Jacob Lett (Jake) is the founder of Bootstrap Creative, a B2B marketing consultancy specializing in manufacturers and industrial companies. A HubSpot-certified CMS developer, SEO, Answer Engine Optimization (AEO), and RevOps professional, he helps B2B companies improve their websites, search visibility, HubSpot systems, and Google Ads campaigns to generate more qualified leads and RFQs. With over a decade of hands-on experience, he acts as a direct partner for companies seeking measurable ROI from their marketing investment.



Topic:

Related posts
Category: Code Snippets

Tags: ,

| Read My Editorial Policy

Want to Get Email Updates of New Articles?

Join My Email Newsletter