Your platform

    The widget is one tag on each listing page, filled in with that listing's values. Here is how that looks on the common kinds of site.

    Any website

    Paste the tag from Embedding the widget just before </body> on the listing page, with the listing's ID, latitude and longitude, and the guest's dates where the page has them. One page, one listing, one tag.

    Listing templates

    Most platforms build every listing page from one template. Put the tag in that template and let the template fill in each listing's values, with your key kept in one setting rather than typed into every template, and the guest's dates wherever your page keeps them — often the page's address, carried over from the search. Left empty, they're no dates. In PHP:

    <script
      src="https://platform.moveguide.co/widget-embed.js"
      data-api-key="<?= htmlspecialchars(MOVEGUIDE_KEY) ?>"
      data-property-id="<?= htmlspecialchars($listing['id']) ?>"
      data-lat="<?= htmlspecialchars($listing['lat']) ?>"
      data-lng="<?= htmlspecialchars($listing['lng']) ?>"
      data-checkin="<?= htmlspecialchars($checkin ?? '') ?>"
      data-checkout="<?= htmlspecialchars($checkout ?? '') ?>"
    ></script>

    In a template language such as Liquid, Jinja, Twig or Handlebars, with your own field names:

    <script
      src="https://platform.moveguide.co/widget-embed.js"
      data-api-key="{{ moveguide_key }}"
      data-property-id="{{ listing.id }}"
      data-lat="{{ listing.lat }}"
      data-lng="{{ listing.lng }}"
      data-stay-type="{{ listing.stay_type }}"
      data-checkin="{{ checkin }}"
      data-checkout="{{ checkout }}"
    ></script>

    In WordPress, the same tag goes in your theme's single-listing template; the fields are wherever your theme or listings plugin keeps a listing's location.

    Site builders

    Most site builders have a place for custom code at the end of a page. On a template page that shows one listing at a time, insert the listing's own fields into the tag where the builder allows it — Webflow's CMS template pages do. Where a builder can't fill fields into code, give each listing page its own tag.

    Single-page apps

    In React, Next.js, Vue and similar, render the tag on the listing page. When the guest chooses or changes their dates without a new page load, tell Avis with Moveguide.setDates. In Next.js:

    "use client";
    import Script from "next/script";
    import { useEffect } from "react";
    
    type Listing = { id: string; lat: number; lng: number };
    type Dates = { checkin?: string; checkout?: string };
    
    export function Avis({ listing, dates }: { listing: Listing; dates: Dates }) {
      // The guest's dates, as they choose or change them on the page
      useEffect(() => {
        (window as any).Moveguide?.setDates?.(dates.checkin ? dates : null);
      }, [dates.checkin, dates.checkout]);
    
      return (
        <Script
          src="https://platform.moveguide.co/widget-embed.js"
          data-api-key={process.env.NEXT_PUBLIC_MOVEGUIDE_KEY}
          data-property-id={listing.id}
          data-lat={String(listing.lat)}
          data-lng={String(listing.lng)}
          data-checkin={dates.checkin ?? ""}
          data-checkout={dates.checkout ?? ""}
        />
      );
    }

    The widget reads the tag once, when it loads. In an app where going from one listing to another doesn't load a new page, the widget keeps the first listing — so make links between listings full page loads (a plain <a> rather than the router's link) until the widget can switch listings in place.

    Before you go live

    • Every domain the widget appears on is whitelisted, and its pages are served over https.
    • Each listing page carries its own listing ID and location — latitude first, in decimal degrees.
    • Your live site uses a live key made for it — a test key there shows "Test" and stops at 100 questions a day — and keys you no longer use are revoked.
    • data-stay-type is set when your platform has more than one kind of listing.
    • The guest's dates are passed once they've chosen them — in the tag, and with Moveguide.setDates when they change on the page — and your search box sends them too (Search).
    • You've tried a few of your listings in the sandbox, and your first live calls show in Logs.