---
title: "Add an email contact form to Google Sites"
canonical: "https://glueforms.com/docs/connect-google-sites"
language: "en"
description: "Receive Google Sites enquiries by email with a linked GlueForms page or a custom HTML form in an embedded block."
---

# Add an email contact form to Google Sites

Collect enquiries from Google Sites in GlueForms and receive an email notification. Start with a button that opens your published form, or add your own HTML form inside an embedded block.

## Add a contact button

1. Choose a [template](https://glueforms.com/templates), connect it and choose **Publish page**. Open **Open published form** and copy its address, which contains `/f/`.
2. In Google Sites, choose **Insert → Button**, name it “Contact us” and paste that published address. Publish the site.

This opens a separate form page. Do not embed the GlueForms hosted page as an iframe or use its `/s/` receiving URL as a button destination.

## Keep the form inside your page

Use this alternative if you can maintain custom HTML. In Sites, choose **Insert → Embed → Embed code**. Paste this example, select **Next**, then **Insert** and publish. Replace `YOUR_FORM_URL` with your receiving URL, or select a form above.

```html
<style>
  form {
    display: grid;
    gap: 16px;
    font: 16px system-ui;
  }
  label {
    display: grid;
    gap: 6px;
  }
  input,
  textarea,
  button {
    font: inherit;
    padding: 10px;
  }
</style>
<form id="contact" action="YOUR_FORM_URL" method="POST">
  <label
    >Email (optional)
    <input type="email" name="email" autocomplete="email" />
  </label>
  <label
    >Message
    <textarea name="message" rows="4" required></textarea>
  </label>
  <button type="submit">Send message</button>
  <p id="form-status" role="status" aria-live="polite"></p>
</form>
<script>
  const form = document.querySelector('#contact');
  const status = document.querySelector('#form-status');
  const button = form.querySelector('[type="submit"]');
  let pending = null;
  form.addEventListener('input', () => {
    pending = null;
  });
  form.addEventListener('submit', async (event) => {
    event.preventDefault();
    if (button.disabled) return;
    if (!pending) {
      pending = new FormData(form);
      pending.set('submission_id', crypto.randomUUID());
    }
    const payload = pending;
    button.disabled = true;
    status.textContent = 'Sending…';
    try {
      const response = await fetch(form.action, {
        method: 'POST',
        body: payload,
        credentials: 'omit',
        headers: { Accept: 'application/json' },
      });
      const receipt = await response.json();
      if (!response.ok || receipt.accepted !== true) throw new Error();
      status.textContent = 'Message received.';
      if (pending === payload) {
        pending = null;
        form.reset();
      }
    } catch {
      status.textContent = 'Could not confirm receipt. Your fields are still here. Try again.';
    } finally {
      button.disabled = false;
    }
  });
</script>
```

Email is optional. The script confirms receipt inside the embed and keeps the fields if confirmation fails. Retrying unchanged fields reuses the same submission ID.

Google isolates embedded code. This example requires a form without website-origin restrictions. A restriction to your Sites address can reject an embedded request. For a restricted form, use the hosted-page button and allow `https://glueforms.com` in its website settings. For a form with antispam verification, use the hosted page or add the [verification widget](https://glueforms.com/docs/spam).

Open the published site while signed out and send a message. Check the saved message and email notification in GlueForms. If the embed is blocked by your organization, keep the button instead.

[Google Sites code embeds](https://support.google.com/sites/answer/90569?hl=en). [Google Sites buttons](https://support.google.com/sites/answer/90538?hl=en).
