Tracking: SevenRooms bookings

  • Updated

Recording bookings made on SevenRooms' booking pages.

The problem this solves

When a guest books through SevenRooms, they complete the booking on SevenRooms' own booking pages (www.sevenrooms.com/explore/<venue>/reservations/...), not on your website. Distil records SevenRooms bookings by running on SevenRooms' pages, through your Google Tag Manager container.

How it works

  1. SevenRooms loads your Google Tag Manager container on its booking pages.
  2. When a booking is completed, SevenRooms sends the GTM event successfulCheckout, with the booking's details.
  3. A Distil booking tag on that event records the booking. SevenRooms bookings are identified by their reference code.
  4. On your site, the tracking script adds the visitor's ID to links to SevenRooms when they're clicked, so the booking can be linked to the visit.

Requirements

  • Your site uses Google Tag Manager.
  • SevenRooms loads your container on its booking pages. To check, open your venue's booking page on www.sevenrooms.com, open the browser console, and type Object.keys(window.google_tag_manager || {}). Your container's GTM-… ID should be listed. If it isn't, ask SevenRooms to add your container.

Setup

This setup is available from Distil as a ready-made Google Tag Manager import file, including the booking tag (see Installing with Google Tag Manager).

You need two tracking tags: the one you already have for your website, and a second one for SevenRooms' pages. They're set up slightly differently, because they do different jobs.

1. Your website's tracking tag (the tag from Installing with Google Tag Manager). Make two changes to it:

  • Change its distil.load(...) line to:

    distil.load("YOUR_ACCOUNT_KEY", { trackSevenRooms: true });

    If that line already has options, for example trackOpenTable: true, keep them: { trackOpenTable: true, trackSevenRooms: true }.

    trackSevenRooms: true adds the visitor's ID to links to SevenRooms when they're clicked, so the booking can be linked to the visit on your site.

  • Change each of its triggers to fire on Some events, with the condition Page Hostname · does not contain · sevenrooms.com. This keeps this tag off SevenRooms' pages, which get their own tag in step 2.

2. A second tracking tag, for SevenRooms' pages. This one uses the plain distil.load(...) line, without trackSevenRooms. On SevenRooms' pages, the tracking script automatically picks up the visitor's ID from the link the guest clicked, so there are no links for it to tag.

Setting Value
Tag name Distil - Tracking Script (SevenRooms)
Tag type Custom HTML
HTML the tracking script from the Quick start, with the distil.load(...) line as distil.load("YOUR_ACCOUNT_KEY");
Trigger DOM Ready, Some DOM Ready Events, condition Page Hostname · contains · sevenrooms.com
Consent settings Require additional consent for tag to fire → analytics_storage
Tag firing options Once per event

3. GTM variables for the booking details. Create these in Variables → User-Defined Variables → New, each as a Data Layer Variable:

Variable name Data Layer Variable Name What it is
SR - referenceCode referenceCode The booking's reference code. Required: this is how Distil identifies the booking
SR - partySize partySize Number of guests
SR - day day Booking date
SR - timeslot timeslot Booking time
SR - merchant_id merchant_id The restaurant

If your SevenRooms reservation data is connected to Distil, Distil also matches each booking to it by the reference code, and takes the final party size, date, time and restaurant from there.

4. The booking tag:

Setting Value
Tag name Distil - SevenRooms Booking
Tag type Custom HTML
Trigger Custom Event successfulCheckout
Consent settings Require additional consent for tag to fire → analytics_storage
<script>
window.distil.trackReservation({
  referenceCode: {{SR - referenceCode}},
  partySize:     Number({{SR - partySize}}),
  bookingDate:   {{SR - day}},
  bookingTime:   {{SR - timeslot}},
  restaurant:    {{SR - merchant_id}}
});
</script>

Adding the guest's details (optional)

If your SevenRooms reservation data is connected to Distil, you don't need this to know who made the booking: Distil matches each booking to it by the reference code, and the guest's details come from there.

Sending the guest's email from the booking page is an extra: it identifies the visitor's browser as that guest straight away, at the moment of booking. Add it only if you want that. Add one more Data Layer Variable:

Variable name Data Layer Variable Name
SR - email email

Then use one of these two options.

Option A: pass the guest's details with the booking. Use this booking tag instead of the one in step 4 of SevenRooms bookings → Setup:

<script>
var email = {{SR - email}};
var customer = (typeof email === "string" && email.indexOf("@") > 0)
  ? { EmailAddress: email }
  : undefined;
window.distil.trackReservation({
  referenceCode: {{SR - referenceCode}},
  partySize:     Number({{SR - partySize}}),
  bookingDate:   {{SR - day}},
  bookingTime:   {{SR - timeslot}},
  restaurant:    {{SR - merchant_id}}
}, customer);
</script>

The email check matters: if the guest's details are sent with an empty email, the whole booking is rejected, not just the email. With the check, a booking with no email is still recorded, just without the guest's details.

Option B: identify the guest separately. Use this booking tag instead of the one in step 4 of SevenRooms bookings → Setup. It sends the booking, then identifies the guest:

<script>
window.distil.trackReservation({
  referenceCode: {{SR - referenceCode}},
  partySize:     Number({{SR - partySize}}),
  bookingDate:   {{SR - day}},
  bookingTime:   {{SR - timeslot}},
  restaurant:    {{SR - merchant_id}}
});
var email = {{SR - email}};
if (typeof email === "string" && email.indexOf("@") > 0) {
  window.distil.identifyCustomer({
    EmailAddress: email,
    GDPRStatus: {
      MarketingSubscribed: MARKETING_CONSENT   /* replace with true or false: the guest's real choice */
    }
  });
}
</script>

identifyCustomer requires a GDPRStatus object with MarketingSubscribed (see Sending your own events → Identifying a customer). Replace MARKETING_CONSENT with the guest's actual marketing choice, for example from a GTM variable. Don't fill it in with a fixed value: true would record consent the guest never gave, and false could overwrite consent they gave earlier. If you don't have the guest's marketing choice at checkout, use Option A, which doesn't need GDPRStatus.

Checking it

After publishing (SevenRooms' pages load the published container):

  1. Start on your website, accept cookies if asked, and click its link to SevenRooms. SevenRooms' address should contain daid= and dref=, and in the console, window.distil.VERSION shows the tracker version.
  2. Make a test booking, then cancel it. On the confirmation page, a request containing "Value":"book-reservation" and a ReferenceCode is sent.

Good to know: a SevenRooms booking is linked to the visit on your site only when the guest reaches SevenRooms through a link or button on your site. Otherwise it's recorded under a visitor ID created on sevenrooms.com.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.

Still have questions?

Contact us