Marketing -> Email - add scripts to own custom html template

Hi,

we have created a custom email template within Emailify (has Hubspot integration). Using the API, we got the HTML into Hubspot’s Design Manager, where we can see the clean code, without any added scripts from Hubspot.

When we create a new email in Marketing → New Email and select our prepared HTML as the template, we get these scripts inserted into the code, which mail-tester.com marks as dangerous elements that reduce deliverability.

<!-- Start of HubSpot Analytics Code Not Loaded -->
<script>
(function(){
const timeoutEvent = document.createEvent(‘CustomEvent’);
timeoutEvent.initCustomEvent(“content-analytics-code-not-loaded”, true, true, { detail: “Not loaded in preview mode” });
window.dispatchEvent(timeoutEvent);
})();
</script>
<!-- End of HubSpot Analytics Code Not Loaded -->

<script type=“text/javascript”>
var hsVars = {
render_id: “c97d5811-aa1c-4f39-997a-1a281b586782”,
ticks: 1743838403954,
page_id: 224839680240,
content_group_id: 0,
portal_id: 143763891,
app_hs_base_url: “https://app-eu1.hubspot.com”,
cp_hs_base_url: “https://cp-eu1.hubspot.com”,
language: “cs”,
analytics_page_type: “email”,
scp_content_type: “”,
analytics_page_id: “224839680240”,
category_id: 2,
folder_id: 0,
is_hubspot_user: false
}
</script>

<script defer src=“https://static.hsappstatic.net/HubspotToolsMenu/static-1.432/js/index.js”></script>

At the same time, if we build an email directly in Hubspot from their modules, these scripts are not inserted there.

Does anyone have experience with this and know why this happens or how to prevent it please? Does it really affect deliverability? We have failed to send out the email (the reason may be the database we have from the client and we are checking its quality) and would like to rule out this possibility. At the same time one of the scripts is javascript, which should not be in the emails at all..

Thank you very much for your experience.

@JPouska Great question! — this happens because when you import raw HTML into HubSpot via Design Manager, HubSpot treats it differently than native drag-and-drop templates. It often injects internal scripts for analytics or preview rendering.

These scripts usually don’t appear in the final sent email, but I recommend testing by sending it to yourself and inspecting the raw email source (e.g., in Gmail: “Show original”).

If the scripts do remain, they could slightly hurt deliverability, especially because JavaScript isn’t supported in email and can flag spam filters.

To avoid this, you might consider rebuilding the template using HubSpot modules, which handle tracking and structure natively without injecting additional code.
Additionally, I was not familiar with Emilify tool and found this video tutorial that explains how to embed correctly the HTML into HubSpot - this could also help, so here’s the link: How to export HTML emails from Figma to HubSpot using Emailify - Hypermatic

Hope this helps clarify! Let me know if you want help testing the final output.

Carolina De Mares

Brandgang

Goirkekanaaldijk 14

5046 AT Tilburg