Skip to main content

Connecting Google Tag Manager for appointment analytics

How do I connect Google Tag Manager for analytics?

Track every step of your client's booking journey — from landing on your page to confirming the appointment — so you can measure marketing ROI in Google Ads, GA4, or any other analytics platform.

This article walks you through the complete setup end-to-end. Allow about 30 minutes. You'll need:

  • A Carepatron workspace with Online Booking enabled and admin access

  • A Google Tag Manager (GTM) account and container

  • A Google Ads or GA4 property where you want conversions to land


What you'll achieve

By the end of this setup, Google Ads or GA4 will record a conversion every time someone completes a booking through your Carepatron booking link. This gives Smart Bidding (Maximise Conversions, tROAS) real outcome data instead of just click data, and lets you attribute revenue back to specific campaigns, keywords, and ads.

The event that fires on a completed booking is called booking_confirmation. Everything below is about getting that event from Carepatron's booking flow through GTM and into your analytics platform.


Step 1: Add your GTM container ID to Carepatron

  1. Open your Carepatron workspace and go to Settings → Scheduling → Online Booking.

  2. Scroll down to Analytics integration and click Edit.

  3. Paste your GTM container ID (format: GTM-XXXXXXXX) and click Save.

That's it on the Carepatron side. Behind the scenes we load your GTM container on your booking page (book.carepatron.com/YourWorkspace) and wire it up to receive the booking events.

Important to know: We attach your container to a workspace-specific dataLayer named userDataLayer_<YourWorkspace> rather than the default window.dataLayer. You don't need to do anything to support this — standard Custom Event triggers in GTM will pick events up automatically. We mention it only so the next section makes sense if you're inspecting the page in DevTools.


Step 2: Set up Consent Defaults in your GTM container

Do this before you create any tags. Google's Consent Mode requires every modern GTM container to declare default consent states before any tag is allowed to fire. Skip this and your conversion tags will be silently blocked, even though they look correctly configured.

  1. Open your container in Google Tag Manager

  2. Tags → New → Tag Configuration → Custom HTML

  3. Name it Consent Defaults — Grant All (or "Set per region" if you'd prefer to deny analytics consent by default for EU visitors and let your cookie banner update it later)

  4. Paste this exact code:

    <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('consent', 'default', {   'ad_storage': 'granted',   'analytics_storage': 'granted',   'ad_user_data': 'granted',   'ad_personalization': 'granted',   'wait_for_update': 500 }); </script>
  5. Triggering → Consent Initialization — All Pages

  6. Save the tag

If you operate in the EU, replace 'granted' with 'denied' and update the consents from your cookie banner when the visitor accepts. Carepatron customers outside the EU can leave everything as granted.


Step 3: Add the Google Tag for your destination

The "Google tag" is the foundational tag that lets Google Ads or GA4 receive events from your container. You only need one per destination ID.

  1. Tags → New → Tag Configuration → Google tag

  2. Tag ID:

    • For Google Ads, paste your Google Ads conversion ID: AW-XXXXXXXXXX (find it in Google Ads → Goals → Settings → "Your Google Ads account")

    • For GA4, paste your Measurement ID: G-XXXXXXXXXX (find it in GA4 → Admin → Data Streams → Web stream)

  3. Triggering → Initialization — All Pages

  4. Save the tag

If you want to track in both Google Ads and GA4, you can add both IDs as additional Tag IDs on a single Google tag.

You should also add a Conversion Linker tag (Tags → New → Conversion Linker → All Pages) — this preserves click IDs across domains and is required for accurate Google Ads attribution.


Step 4: Create the booking confirmation trigger

This is the trigger that listens for completed bookings.

  1. Triggers → New → Trigger Configuration → Custom Event

  2. Event name: booking_confirmation (exact spelling — case-sensitive, no quotes)

  3. This trigger fires on: All Custom Events

  4. Name it Booking Confirmed — Carepatron and save

That's the only trigger you need. Don't filter by URL, activeStep, page path, or anything else — the event fires exactly once when the booking confirmation page renders, and any extra filter risks blocking valid conversions.

⚠️ A warning if you're poking around in DevTools: Carepatron's internal analytics also pushes events called Booking step loaded (with parameters like activeStep: 'confirmation') into window.dataLayer. Those are for our internal product analytics — your container doesn't see them, and they shouldn't be your trigger. Always use the booking_confirmation Custom Event.


Step 5a: Wire up a Google Ads conversion (recommended path)

Before you can record a conversion in Google Ads, the conversion action has to exist in your Google Ads account.

5a.1 — Create the conversion action in Google Ads

  1. In Google Ads, go to Goals → Summary → + Create conversion action

  2. Choose Conversions on a websiteSave and continue

  3. Pick the Book appointment category (or whichever category fits)

  4. Click + Create conversion → choose your website data source → Manually with code

  5. Configure:

    • Action optimisation: Primary if this is your main bidding signal, or Secondary if you already optimise on another action (e.g. a "Book a session" button click) and want bookings as an observation-only metric until you have ~30 events/month

    • Conversion name: Booking Confirmed

    • Value: "Use the same value for each conversion" — set your average session price

    • Count: One (each booking is one lead, not multiple)

    • Click-through window: 30–90 days (longer is better for considered purchases like therapy)

    • Attribution: Data-driven (recommended)

  6. Click Done → Save and continue

  7. On the next screen click Use Google Tag Manager — you'll see a table with:

    • Conversion name: Booking Confirmed

    • Conversion label: (e.g. jpybCMWExsgcEKihtYdD) — copy this

    • Conversion ID: (e.g. 18000728232) — copy this too

Keep this tab open. You need both values for the next sub-step.

5a.2 — Create the conversion tracking tag in GTM

  1. Tags → New → Tag Configuration → Google Ads Conversion Tracking

  2. Conversion ID: paste the ID from step 5a.1 (numbers only, no AW- prefix)

  3. Conversion Label: paste the label from step 5a.1

  4. Triggering → select the Booking Confirmed — Carepatron trigger you created in Step 4

  5. Name it Google Ads — Booking Confirmed and save

Step 5b: Wire up a GA4 event (alternative or additional)

If you also (or instead) want bookings as a GA4 conversion:

  1. Tags → New → Tag Configuration → Google Analytics: GA4 Event

  2. Measurement ID: your G-XXXXXXXXXX

  3. Event Name: booking_confirmation

  4. Triggering → select the Booking Confirmed — Carepatron trigger

  5. Name it GA4 — Booking Confirmation and save

  6. In GA4: Admin → Events → Mark as key event for booking_confirmation once you've seen the first event arrive


Step 6: Publish and test

  1. In GTM, click Submit (top right) → add a version name like Initial booking_confirmation setup → Publish

  2. Open your Carepatron booking link in a new private/incognito window

  3. Complete a real test booking — if you're a workspace admin you can book against yourself or a test client, and no payment modal will appear

  4. Check your destination platform:

    • Google Ads: Goals → Summary → your Booking Confirmed action. The status will flip from "Inactive" to "Active" after the first conversion. Most accounts show the conversion in the table within 3–24 hours (Google rate-limits new conversion actions).

    • GA4: Reports → Realtime — booking_confirmation events appear within ~60 seconds. Or DebugView if you have GTM Preview Mode on.

If nothing shows up after 24 hours, jump to the troubleshooting section below.


How the dataLayer works (technical reference)

For anyone debugging in DevTools or building custom logic on top:

  • Where the event lives: window.userDataLayer_<YourWorkspace> — for example, a workspace called "Oakwood Clinic" would have window.userDataLayer_OakwoodClinic. This is the dataLayer that your GTM container reads from.

  • What the event looks like:

{

event: 'booking_confirmation',

category: '...',

'gtm.uniqueEventId': 12345

}

  • When it fires: Once, when the booking confirmation page mounts after a successful Carepatron booking

  • What window.dataLayer is for: Carepatron's own internal product analytics. You'll see events like Booking step loaded there — these are not for customer use and your container cannot read them.


postMessage events for iframe embeds

If you embed the Carepatron booking widget inside an iframe on your own website, you can listen for these postMessage events on the parent page:

Event

When it fires

Payload

carepatron.booking.completed

After a booking is successfully created

startDate, endDate (ISO format)

carepatron.booking.date_and_time_selected

When a client picks a timeslot

startDate, endDate

These are not GTM events themselves — they're browser postMessage signals. To use them you need to listen and manually push to your own dataLayer:

window.addEventListener('message', function(e) {

if (e.data?.type === 'carepatron.booking.completed') {

window.dataLayer = window.dataLayer || [];

window.dataLayer.push({

event: 'booking_confirmation',

startDate: e.data.startDate,

endDate: e.data.endDate

});

}

});

For the iframe embed case, this is how your GTM container running on your own site (not on book.carepatron.com) can catch the booking event.


Troubleshooting

My conversion tag isn't firing

  • Check that the Consent Defaults — Grant All tag (Step 2) is published. Without it, modern containers block all tags by default.

  • Confirm you actually published the workspace after saving (top-right Submit button, not just Save).

  • Use GTM Preview Mode and connect it to book.carepatron.com/YourWorkspace?gtm_debug=... — the trigger should appear in the left-side event list as booking_confirmation.

The tag fires but Google Ads says "Inactive" or "No recent conversions"

  • Double-check the Conversion Label in your GTM tag character-by-character — they're case-sensitive and a single wrong character means the conversion is sent to a non-existent action and silently dropped.

  • Confirm the Conversion ID matches your Google Ads account (numeric portion only, no AW- prefix).

  • New conversion actions take 3–24 hours to flip to "Active" in the Google Ads UI even when receiving events.

GA4 Realtime doesn't show the event

  • Confirm you have a Google Tag in the container (Step 3) sending data to your G-XXXXXXXXXX Measurement ID. Without it, GA4 event tags fire but go nowhere.

  • Check the Consent Defaults are set to granted for analytics_storage.

I see Booking step loaded events but no booking_confirmation

  • You're looking at window.dataLayer (Carepatron's internal events). Switch to window.userDataLayer_<YourWorkspace> to see the customer-facing events.

I'm using Smart Bidding — can I optimise on booking_confirmation right away?

  • Only if you accumulate ≥30 events per month. Below that, Smart Bidding lacks signal and performance degrades. Most providers should start Booking Confirmed as a Secondary (observation-only) action while keeping a higher-volume signal like "Book button click" as Primary, then promote to Primary once they have 30+ events/month.


Tracking referral sources (advanced)

For cross-domain tracking — when traffic flows from your main website to book.carepatron.com — your Google tag should include these additional parameters in its Configuration settings:

Parameter

Value

Why

cookie_flags

samesite=none;secure

Required since Chrome's 2020 SameSite cookie changes

allowLinker

true

Lets the Client ID pass between your domain and book.carepatron.com

send_page_view

true

Google's default — leave on


Blacklisted tags

For privacy and security, the following GTM tag types are blocked from running in containers loaded on Carepatron:

ID

Tag

Why it's blocked

html

Custom HTML

Can execute arbitrary scripts that could exfiltrate PHI or PII

adm

Adometry

Could send PII to advertising platforms

ga

Google Analytics (legacy, Universal Analytics)

Lacks built-in privacy controls and is end-of-life

gcs

Google Consumer Surveys

Not appropriate for healthcare contexts

If you try to use one of these tag types, it will be silently skipped at container load. Stick to Google Ads Conversion Tracking, GA4 Event, Conversion Linker, and the modern Google tag — these cover every standard analytics need.


If you've followed every step and conversions still aren't landing, reach out through the Help channel in your workspace. Include:

  • Your GTM container ID

  • The Conversion ID and Conversion Label from your Google Ads action

  • A screenshot of the Tags table in your GTM workspace

  • Whether you've published the workspace (with a version number)

We'll trace the pipeline end-to-end with you.

Our team will be available to answer any further questions you may have. Just reply via messenger through the Help channel in your workspace.

Did this answer your question?