Embed a GatedContent Lead Form in Your Demo

Overview

Use this setup guide to embed your GatedContent lead forms directly in your Walnut demos. This setup enables Walnut to automatically capture email identification, and sync it across your integrations and analytics for deeper engagement tracking.

Once configured, your GatedContent form displays seamlessly inside the demo, and each submission identifies the viewer in Walnut Insights for enriched session and lead reporting.


Setup at a Glance

  1. Copy the starter script provided below.
  2. Paste the starter script into the Embed Code section of your template.
    (Template → Forms → Create Lead Form → Embed code)
  3. Insert your unique GatedContent snippet and gate ID where indicated.
  4. Save your form and publish your demo.
🧩 Important Note:
Unlike HubSpot, Marketo, or Pardot forms, which are supported out of the box, GatedContent forms require a lightweight custom script configuration to connect with Walnut.

Configure Your Form Script

Step 1: Copy & Paste the Starter Script in Your Walnut Template

  • Copy the following starter script and paste it into the Embed code section of the Forms panel of your template. (Template → Forms → Create Lead Form → Embed code).

Screenshot 2025-10-24 at 8.19.31 AM.png

* This starter script acts as the framework for your GatedContent form integration with Walnut. You’ll insert your own GatedContent code snippet and gate ID into the indicated sections.


GatedContent Starter Script

<!-- GatedContent Starter Script -->

<script>
/* ---------------------------------------------------------
   STEP 3a: Paste your GatedContent script snippet below.
   Insert code between the lines indicated. 👇
   --------------------------------------------------------- */

// ↓↓↓ Paste your GatedContent script below this line ↓↓↓



// ↑↑↑ Paste your GatedContent script above this line ↑↑↑

// Adjust modal height & hide Walnut integration containers
var css = document.createElement('style');
css.innerHTML = `
  .gcdc-modal-wrapper.open { height: 100vh !important; }
  .walnut-integrations-main { display: none !important; }
`;
document.head.appendChild(css);

// Example Pardot URL (for reference):
// https://go.demo.pardot.com/l/0/0000-00-00/00

window.addEventListener('gcdcGateSubmitted', function(event) {
  // Capture the viewer’s email from the submitted form
  var emailInput = document.querySelector('.gcdc-modal-wrapper input[type="email"], input[type="email"]');
  var email = (emailInput && emailInput.value) ? emailInput.value : "";

  // Notify Walnut when the gated form is submitted
  setTimeout(function() {
    window.parent.postMessage(
      {"walnut-embedded-form-submitted": {"email": email}},
      window.location.href
    );
  }, 1000);
});
</script>

/* ---------------------------------------------------------------------------
   STEP 3b: Add your Gate ID below. Replace the Xs with your unique Gate ID 👇
   --------------------------------------------------------------------------- */  

<div class="gate-XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"></div>

Step 2: Locate Your GatedContent Form Snippet

  • Your GatedContent form snippet should look something like this:
<script>
   (function (g, a, t, e, d, c, o) {
     if (!g[d]) {
     g.GatedContentObject = d;
     g[d] = g[d] || function () { (g[d].q = g[d].q || []).push(arguments) };
     c = a.createElement(t), o = a.getElementsByTagName(t)[0];
     c.async = 1; c.src = e; o.parentNode.insertBefore(c, o)
   }
})(window, document, 'script', 'https://app.gatedcontent.com/scripts/00000000/app.js', 'gcdc');
gcdc('loadGates');
</script>

<div class='gate-00000000-0000-0000-0000-00000000d000'></div>`      

Step 3: Insert Your Unique GatedContent Code into the Starter Script

  1. Copy the code between your <script> and </script> tags in your unique GatedContent snippet. (*Do not include the <script> tags themselves.)
  2. Paste that portion into the STEP 3a section of the starter script in your Walnut template.
    Paste your code below the line that says:
    // ↓↓↓ Paste your GatedContent script below this line ↓↓↓
  3. Copy your Gate ID (for example, gate-00a0dc0c-00de-000f-afc0-0e000000d000) and replace the placeholder Gate ID in the final <div> line of the starter script.
    This section is labeled STEP 3b: “Add your Gate ID below. Replace the Xs with your unique Gate ID 👇”.
  4. That's it! Finish configuring your form in the Forms panel — adjusting options such as settings, placement, and autoclose behavior as needed for your demo.
  5. Once configured, save your changes and publish a demo to test your form.


⚠️ Important Note:
Always test your form in a published demo
, not within the template editor.
GatedContent forms do not appear in template preview, and submission events will only trigger in the published demo environment.

Step 4: Test Your Form Setup

Once your script and Gate ID are in place, you’re ready to test your form submissions.

  1. Publish a demo containing the form.
  2. Open the published demo in an incognito or private window and submit a test entry through your GatedContent form.
  3. Verify that the form submission is successful and check Walnut → Insights → Demo → Sessions of this demo to confirm that the email submission is captured.

Screenshot 2025-10-23 at 4.06.34 PM.png

🍪 Note: Form submissions use browser cookies to recognize returning users. If a form has already been submitted, it will not appear again for that viewer unless the browser cache or cookies are cleared. For accurate testing, use an incognito window or clear your cache between test submissions.

Was this article helpful?
0 out of 0 found this helpful