Hubl directly places the form as a <form> tag, so that script didn’t work in my particular use case. In case somebody else runs into the same issue later: I solved this by requesting the hsforms tracking gif, and unhiding a warning text if the request fails. In code:
<div class="form_tracking_error hidden">
<p>The Enhanced Tracking Protection settings on your browser might interfere with this download form. If the download isn't starting, set the Enhanced Tracking Protection settings to "standard" and try again.</p>
</div>
<div class="form_display">
{% form
form_to_use="{{ module.popup_contents.field_group.form_field.form_id }}"
response_response_type="{{ module.popup_contents.field_group.form_field.response_type }}"
response_message="{{ module.popup_contents.field_group.form_field.message }}"
response_redirect_id="{{ module.popup_contents.field_group.form_field.redirect_id }}"
response_redirect_url="{{module.popup_contents.field_group.form_field.redirect_url}}"
%}
</div>
<script>
function whenNoTrackingProtection() {
// keeping track of the version of the script, to ensure test pages are up to date
let version = "1.5"
if (!whenNoTrackingProtection.promise) {
whenNoTrackingProtection.promise = new Promise(function(resolve, reject) {
var time = Date.now();
var img = new Image();
img.onload = resolve;
img.onerror = function() {
if ((Date.now() - time) < 100) {
reject(new Error("Rejected."));
} else {
resolve(new Error("Takes too long."));
}
};
img.src='https://forms-na1.hsforms.com/embed/v3/counters.gif';
}).then((result) => {
console.log("Tracking " + version + " OK");
}).catch(e => {
console.log("Tracking " + version + " blocked: " + e);
document.querySelector(".{{ name }} .form_tracking_error").classList.remove("hidden");
});
}
}
whenNoTrackingProtection()
</script>