Skip to main content

Tracking Scripts - Google Analytics 4

How to configure Google Analytics 4 to work with Lodgix

Written by Joseph Alvaro

GA4 vs Universal Analytics

The instructions in this article are specific to Google Analytics 4. If you are looking to setup Google Universal Analytics to work with Lodgix, please refer to this support article instead.

Google Analytics 4 Setup

This article assumes that you have setup Google Analytics 4 by creating your Account, Property, and Data Stream, and that you have added the Google Tag to your website. Instructions from Google for basic GA4 setup can be found here: https://support.google.com/analytics/answer/9304153

Add Google Tag to Lodgix

You will install the Google Tag in Lodgix from Settings > Important Settings > Bookings. This tag should be identical to the one installed on your website...

  1. Paste the tag

  2. Click "Insert tracking script in Header"

  3. Save

Setup Cross Domain Tracking

Cross domain tracking allows you to track the same site visitor session as they move from one domain to another, in this case from your website to the Lodgix booking page where the guest will complete the booking.

Navigate to the Admin section in your Google Analytics account...

Select Property Settings > Data Collection > Data Streams...

Either add a new stream or select the existing stream...

Configure tag settings...

Configure your domains...

From here you will add lodgix.com as one domain, and your domain as the other. In this example we are configuring GA4 for the mauitheme.com domain...

Now that we are tracking users across multiple domains, we will want to track Conversions (reservations) so that we can view them within Google Analytics.

Create Event

In your Google Analytics account, in the Admin section, select Property Settings > Data Display > Events...

Click Create event...

Configure your event with the following conditions, then click Save. Note that you will replace XXXXX in the second condition with your Lodgix customer ID, which can be found within Lodgix under Settings > Important Settings > General...

Create Key Event

Now that the reservation event has been created, you will have to mark this event as a Key Event. This can be done from your Google Analytics account. In the Admin section, select Property Settings > Data Display > Key Events...

Click New key event...

Name the Key Event "reservation" and click Save...

Test in Real Time

You can test the conversion immediately after configuring it. Start by submitting a test booking through your website. Then within your Analytics account, navigate to Reports > Realtime overview. In the Key Events view you should see that the "reservation" event was triggered...

Checkout GA4 / GTM Events

Your booking checkout automatically sends Google Analytics 4 / Google Tag Manager events as guests move through the booking flow. Use these to build funnels, track conversions, and measure drop-off in your own GA/GTM property.

How it works

  • Events fire only when your own GA or GTM snippet is installed (paste it into your Website tracking scripts). If no snippet is present, nothing is sent.

  • Each event is pushed to both the GTM dataLayer and gtag.js, so it works with either setup.

  • Events do not fire in admin preview mode, so your test traffic won't pollute your live data.

Shared booking data

Most events include the same booking details:

  • currency — currency code (e.g. "USD")

  • value — total rental amount for the booking

  • items — one entry per property in the booking, each with:

    • item_id — property ID

    • item_name — property name

    • item_category — always "rental"

    • price — rental amount for that property

    • quantity — number of nights

    • coupon — discount code applied (only if one was used)

Events

begin_checkout — fired when a guest opens the checkout page. Includes the shared booking data.

checkout_progress — fired each time a guest advances to a new step. Includes the shared booking data plus:

  • checkout_step — step number (starting at 1)

  • checkout_step_name — step identifier

  • checkout_step_label — step display name (if available)

  • checkout_previous_step — the step they came from (if available)

add_payment_info — fired when a guest first selects a payment method. Includes the shared booking data plus:

  • payment_type — the chosen payment method

express_checkout_initiated — fired when a guest taps the Apple Pay / Google Pay express button. Includes the shared booking data plus:

  • payment_type — the express method used (e.g. Apple Pay, Google Pay)

apply_discount_code — fired when a discount code is successfully applied. Includes the shared booking data plus:

  • coupon — the code that was applied

discount_code_rejected — fired when a discount code is entered but rejected. Includes only:

  • coupon — the code that was rejected

checkout_error — fired when a guest can't proceed. Includes:

  • kind — the type of problem ("validation" for missing/invalid fields, "submit_failed" if the booking couldn't be submitted)

  • step — the step where it happened

  • from_step — the step they were on, for errors caught at final submit (if applicable)

  • message — error detail, for submit failures (if applicable)

purchase — fired on the confirmation page once the booking is complete. Includes:

  • transaction_id — the reservation ID

  • currency — currency code

  • value — total charged (including taxes and fees)

  • tax — total taxes

  • items — same property details as the shared booking data

  • coupon — discount code applied (if one was used)

Good to know

  • purchase uses the full amount charged (taxes and fees included), while the earlier funnel events (begin_checkout, checkout_progress, etc.) use the rental amount only — so the value figure isn't directly comparable between the start and the end of the funnel.

  • purchase fires only once per booking, even if the guest refreshes the confirmation page.

Did this answer your question?