Thank you. That means a lot.
If you have a minute, sharing an honest review on Amazon helps other technology leaders find the book and decide if it is right for them.
It only takes a minute. A few sentences about what was useful to you is more than enough.
Leave an Honest Review on Amazon
// HubSpot API Configuration const PORTAL_ID = "50075267"; const FORM_ID = "a8195829-31d2-4a1b-81d9-0d589a2619f0"; // Helper: Extract HubSpot Tracking Cookie function getCookie(name) { const value = `; ${document.cookie}`; const parts = value.split(`; ${name}=`); if (parts.length === 2) return parts.pop().split(';').shift(); return ""; } // Main Submission Function function submitRating(ratingValue) { const emailValue = document.getElementById('optional-email').value; const hutk = getCookie('hubspotutk'); // Core data payload const formFields = [ { "name": "book_star_rating", "value": ratingValue.toString() } ]; // Only attach email if user typed something if (emailValue.trim() !== "") { formFields.push({ "name": "email", "value": emailValue.trim() }); } const payload = { "fields": formFields, "context": { "pageUri": window.location.href, "pageName": document.title } }; // Attach tracking cookie for identity matching (if exists) if (hutk !== "") { payload.context.hutk = hutk; } const endpoint = `https://api.hsforms.com/submissions/v3/integration/submit/${PORTAL_ID}/${FORM_ID}`; // Send to HubSpot fetch(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }) .then(response => { // Route user based on rating if (ratingValue >= 4) { window.location.href = "/review/share"; } else { // Pass rating in URL for the Page 2B form to capture window.location.href = "/review/feedback?rating=" + ratingValue; } }) .catch(error => { console.error("Submission Error:", error); // Fallback routing if (ratingValue >= 4) window.location.href = "/review/share"; else window.location.href = "/review/feedback?rating=" + ratingValue; }); } // Attach Event Listeners to Stars on Page Load document.addEventListener("DOMContentLoaded", function() { for (let i = 1; i <= 5; i++) { let starElement = document.getElementById('star-' + i); if(starElement) { starElement.addEventListener('click', function() { submitRating(i); }); } } });