Auto-Submit Password for HubSpot Password-Protected Pages
This guide explains how to set up a password-protected HubSpot page that auto-fills and submits the password using an encoded URL parameter.
How It Works
By adding a small script in the Footer HTML, you can:
- Base64-encode the password
- Pass it as a URL parameter (?protected=...)
- Auto-fill and submit the form on page load
Perfect for sharing trusted content without friction.
Setup Steps
- Add Script to Footer HTML
Go to: Page Settings → Advanced Options → Footer HTML
Paste this:
<!-- Auto-fill & submit password form from encoded URL param -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
jQuery(document).ready(function() {
console.log("Auto-password script running");
setTimeout(function() {
var getuser = getParameterByName("protected");
if (getuser) {
try {
var decodedPassword = atob(getuser);
console.log("Decoded password:", decodedPassword);
var $pwdField = $('#hs-pwd-widget-password');
if ($pwdField.length) {
$pwdField.val(decodedPassword);
$pwdField.closest("form").submit();
console.log("Form submitted");
} else {
console.warn("Password field not found");
}
} catch (err) {
console.error("Base64 decode failed:", err);
}
}
}, 500);
});
</script>
- Encode Your Password
Open the browser console and type:
btoa("yourpasswordhere")
Example:
btoa("amplifyetfs") → YW1wbGlmeWV0ZnM= - Build the URL
Append your encoded password to the URL like this:
https://yourdomain.com/yourpage?protected=YW1wbGlmeWV0ZnM=
When visited, the script will decode amplifyetfs, auto-fill, and submit the form.
Examples
Example 1
Page: https://info.advisoryresearch.com/stifel-event
Password: $tifel3vent2025
Encoded: JHRpZmVsM3ZlbnQyMDI1
Final link:
https://info.advisoryresearch.com/stifel-event?protected=JHRpZmVsM3ZlbnQyMDI1
Example 2
Page: https://go.amplifyetfs.com/merrillPassword: amplifyetfs
Encoded: YW1wbGlmeWV0ZnM=
Final link:
https://go.amplifyetfs.com/merrill?protected=YW1wbGlmeWV0ZnM=
Notes & Best Practices
- Base64 encoding is not encryption — use only for trusted audiences.
- Ensure jQuery is loaded (included in script).
- Always set pages to noindex, nofollow:
- <meta name="robots" content="noindex, nofollow">
- Test in an incognito window.
Quick Checklist
Step |
Action |
| 1 | Add script to Footer HTML |
| 2 | Encode password in Base64 |
| 3 | Add to URL as ?protected= |
| 4 | Test auto-submit |
| 5 | Mark page noindex, nofollow |