Server-Side Google Tag Manager

Server-Side Google Tag Manager

Server-Side Google Tag Manager — Setup Guide

ReDi Restaurant Reservation plugin supports server-side Google Tag Manager (sGTM) for accurate conversion tracking. When a guest makes a reservation, the plugin sends a reservation_complete event directly from your server to Google Analytics 4 — bypassing ad blockers and browser restrictions.

This feature also tracks referral attribution: if a guest arrives from Google Ads, clicks through several pages, and books a table later — the reservation is correctly attributed to the original ad click.


What you need before starting

  • Google Analytics 4 property with a web data stream

  • Google Tag Manager server-side container (deployed)

  • Access to ReDi plugin settings in WordPress admin

If you don't have a server-side GTM container yet, see "Deploying a server-side container" at the end of this guide.


Step 1: Create a GA4 Measurement Protocol API Secret

  1. Go to Google Analytics

  2. Navigate to AdminData Streams → select your web stream

  3. Scroll down to Measurement Protocol API secrets

  4. Click Create and give it a name (e.g. "ReDi sGTM")

  5. Copy the generated Secret value — you'll need it in Step 3

Also note your Measurement ID from the top of this same page (format: G-XXXXXXXXXX).

Step 2: Verify your sGTM container URL

Your server-side GTM container has a URL, typically something like:

https://gtm.yourdomain.com

or if using Google's default:

https://your-project-id.uc.r.appspot.com

Make sure this container is running and accessible. You can test by visiting the URL in a browser — it should return a blank page or a small response (not a 404 or error).

Step 3: Configure the ReDi plugin

  1. In WordPress admin, go to ReDi RestaurantSettings

  2. Find the Server-Side Google Tag Manager section

  3. Fill in the three fields:

Field

Value

Example

Field

Value

Example

sGTM Endpoint URL

Your server container URL

https://gtm.yourdomain.com

GA4 Measurement ID

From your GA4 data stream

G-A1B2C3D4E5

GA4 API Secret

From Step 1

xYz123AbC...

  1. Save settings

That's it on the WordPress side. The plugin will now automatically:

  • Capture referral data (UTM parameters, Google click IDs) when guests first visit your site

  • Preserve that data as the guest navigates between pages

  • Send a reservation_complete event to your sGTM container when a reservation is successfully created

Step 4: Configure your sGTM container to receive events

In your Google Tag Manager server-side container:

4a. Add a GA4 Client

  1. Go to ClientsNew

  2. Choose GA4 client type

  3. Leave default settings

  4. Save

This client listens for incoming Measurement Protocol requests.

4b. Add a GA4 Event Tag

  1. Go to TagsNew

  2. Choose Google Analytics: GA4 tag type

  3. Configure:

    • Measurement ID: your G-XXXXXXXXXX

    • Leave "Use Default GA4 Configuration" checked

  4. Set trigger: create a custom trigger where Event Name equals reservation_complete

  5. Save

4c. (Optional) Add a Google Ads Conversion Tag

If you want reservations to count as Google Ads conversions:

  1. Go to TagsNew

  2. Choose Conversion Linker tag (if not already present) — set it to fire on all events

  3. Create another tag: Google Ads Conversion Tracking

  4. Configure with your Conversion ID and Conversion Label from Google Ads

  5. Set trigger: same reservation_complete trigger

  6. Save

4d. Publish the container

Click Submit in the top right to publish your sGTM container changes.


What data is sent with each reservation event

Parameter

Description

Example

Parameter

Description

Example

reservation_id

Unique reservation number

4680868

party_size

Number of guests

4

start_time

Reservation date and time

2026-07-30 13:00

source

Booking source

HOMEPAGE

utm_source

Traffic source

google

utm_medium

Marketing medium

cpc

utm_campaign

Campaign name

summer_promo

utm_term

Search keyword (if available)

restaurant booking

utm_content

Ad variation (if available)

banner_v2

gclid

Google Ads click ID

EAIaIQobChMI...

gbraid

Google Ads iOS click ID

(if applicable)

fbclid

Facebook click ID

(if applicable)

referrer

Original referring URL

https://www.google.com/

landing_page

First page the guest visited

/menu

The client_id is also sent for GA4 session stitching — it is read automatically from the guest's _ga cookie if Google Analytics is running on the site.


How attribution tracking works

  1. A guest clicks a Google Ad and lands on your site (e.g. the menu page)

  2. The plugin captures the referral data (gclid, UTM parameters, referrer URL) and stores it in a first-party cookie on your domain

  3. The guest browses your site — menu, about page, location, etc. The cookie persists across all pages

  4. The guest navigates to the reservation page and books a table

  5. When the reservation is confirmed, the plugin reads the stored attribution data and sends it to your sGTM container along with the reservation details

  6. Google Analytics 4 (and optionally Google Ads) receives the event with correct attribution

This works regardless of which page the guest landed on first, and even if they visit multiple pages before making a reservation.

The attribution cookie uses first-touch logic: if a guest returns later from a different source, the original attribution is preserved (30-day window).


Testing your setup

Quick test

  1. Visit your restaurant website with test UTM parameters:

    https://your-restaurant.com/?utm_source=google&utm_medium=cpc&utm_campaign=test123&gclid=fakeclickid
  2. Navigate to a different page on the site

  3. Go to the reservation page and make a test reservation

  4. Check Google Analytics 4RealtimeEvents — you should see reservation_complete with the test UTM values

Verify the cookie

  1. After visiting with UTM parameters, open your browser Developer Tools (F12)

  2. Go to ApplicationCookies → your domain

  3. Look for redi_attribution — it should contain your UTM parameters

Verify in ReDi dashboard

The attribution data is also saved with each reservation as a TrackingCode parameter. You can see it in the reservation details in the ReDi management dashboard.


Troubleshooting

Problem

Solution

Problem

Solution

No events appearing in GA4 Realtime

Check that all three settings fields are filled in correctly. Verify your sGTM container is running.

Cookie not being set

Make sure the guest is visiting the site with UTM parameters or from an external referrer. Direct visits without parameters don't create a cookie (this is by design).

client_id shows as a random UUID instead of GA format

This means GA4 client-side tracking (gtag.js) is not running on the site. The event still works, but session stitching won't link it to the web session. Install GA4 on the site for full integration.

Events arrive but with empty attribution

The guest visited directly (no referrer, no UTM params). This is normal — not all reservations come from ad clicks.

Google Ads not showing conversions

Make sure you have a Conversion Linker tag and a Google Ads Conversion Tracking tag in your sGTM container, both configured to fire on reservation_complete. Allow 24–48 hours for conversions to appear.


Deploying a server-side GTM container (if you don't have one)

Google provides a free-tier option using Google Cloud:

  1. Go to tagmanager.google.com

  2. Create a new Container → select Server as the target platform

  3. Choose Automatically provision → this deploys on Google Cloud Run

  4. Follow the setup wizard — Google will create the server and give you the container URL

  5. Use that URL as your sGTM Endpoint URL in the ReDi plugin settings

Google Cloud Run offers a generous free tier that is sufficient for most restaurant websites.

For detailed instructions, see Google's official sGTM setup guide.


Privacy and consent

The attribution cookie (redi_attribution) is a first-party, functional cookie set on your restaurant's own domain. It does not track users across sites and contains no personal information — only marketing parameters from the URL.

If your site uses a cookie consent banner (recommended for GDPR compliance), you may want to classify this cookie under "Marketing" or "Analytics" cookies and only set it when the guest has given consent. Contact ReDi support for guidance on integrating with your specific consent management platform.

Server-side events should respect the same consent decisions as client-side tracking. If a guest has not consented to analytics cookies, the attribution cookie will not be present and no server-side event with attribution data will be sent.