# Embeds Two script tags, for the two things sellers want on a domain they already own: the whole landing page, or just a contact form somewhere on their own page. Both work out which listing they belong to from the host page, so the same line works on every domain on your account. There is no API key here and nothing to configure. Enquiries from an embed arrive as ordinary leads, so they show up in your inbox, over the [API](https://ydomain.com/docs/api/leads) and in the `lead.created` [webhook](https://ydomain.com/docs/webhooks) like any other. Each listing also shows its own snippets in the account area under **Domains → Edit → Integrate**. ## Full landing page Put this on the site the domain itself serves. It replaces the page with the listing's landing page: name, description, metrics, the contact form, and the price when the listing may show one. ```html ``` It is the marketplace listing page, minus the marketplace header and the breadcrumb that leads back into it. The framed copy is `noindex`, so it never competes with the listing itself in search results. | Attribute | Default | Use | | --- | --- | --- | | `data-domain` | The page host | When the page is not served by the listing | | `data-locale` | `` | Force a language | ```html ``` A host that is not listed with us leaves the page untouched, so an accidental install on the wrong site does nothing. ## Contact form only Put this where you want the form. It renders in place, in a frame that reports its own height, so it grows and shrinks with its content. ```html ``` | Attribute | Default | Use | | --- | --- | --- | | `data-domain` | The page host | When the page is not served by the listing | | `data-locale` | `` | Force a language | | `data-target` | Next to the script tag | CSS selector to render into | | `data-max-width` | `560` | Widest the form may get, in pixels | | `data-height` | `720` | Height to start at, before the form reports its own | ```html
``` What to expect: - Enquiries land in your normal lead inbox, tagged with source `embed`. - Views from an embed are counted apart from marketplace views, so the stats page shows parked traffic separately. - A subdomain falls back to the listing above it: a form on `offers.example.net` belongs to `example.net`. - On a listing that may not advertise a sale the form is still there, without any offer field or sale wording. ### Without JavaScript Frame it yourself. This is the only page of ours that may be framed on another site. ```html ``` The framed form posts its height to the parent window, if you want to size it yourself: ```js window.addEventListener('message', (event) => { if (event.origin !== 'https://ydomain.com') return; const payload = event.data && event.data.ydomainEmbed; if (!payload || payload.type !== 'height') return; document.querySelector('iframe').style.height = `${payload.value}px`; }); ``` ## Resolving a host yourself Both scripts use one small public endpoint, and so can you. It needs no authentication and is CORS-open. ```bash curl "https://ydomain.com/embed/resolve?host=offers.example.net&locale=nl" ``` | Parameter | Notes | | --- | --- | | `host` | Hostname to look up. A leading `www.` is ignored | | `locale` | Optional; falls back to the default language | ```json { "found": true, "domain": "example.net", "url": "https://ydomain.com/nl/embed/lead-form/example.net", "landing_url": "https://ydomain.com/nl/embed/landing/example.net", "title": "Make an offer for example.net", "height": 720 } ``` An unknown, hidden or unpublished listing answers plainly, and the scripts then render nothing: ```json { "found": false } ``` `title` never promises a sale the listing may not advertise: on a parked name it comes back as "Contact the owner of example.net". Answers are cached for five minutes, so a listing you have just published can take that long to appear on a parked page.