Skip to main content
NewNMC’s advertising guidelines for doctors are in force from 6 Oct 2026. See what to change, and get a free compliance auditNew NMC advertising rules for doctors: what to change
Analytics

Server-Side Tagging Filters: Stripping Identifiers Before Data Reaches Ad Platforms

How to use server container transformations and trigger rules so ad platforms receive only approved events and fields, with a rule set for a healthcare site and tests that prove it works.

Server-Side Tagging Filters: Stripping Identifiers Before Data Reaches Ad Platforms

The usual argument for server-side tagging is performance or cookie durability. For a healthcare organisation the better argument is control. Once events arrive at your own server container, you decide, in one place, which events go to which platform and which fields travel with them. That only happens if you write the rules. A server container that passes on everything it receives is a proxy, not a filter.

This article is for analysts and engineers who already have a server container running and need to design the filtering layer. If you are still building the container, start with Google's Cloud Run setup guide first. For the consent model that sits above these rules, see server-side tracking and consent mode for healthcare. Here the question is narrower: how do you make sure an ad platform sees only what you have approved?

The two filtering tools

The server container gives you two separate mechanisms, and good rule sets use both.

Triggers decide whether a tag fires at all. A tag attached to a trigger such as "event name equals generate_lead" will not fire for page_view. This is the control for which events reach a platform.

Transformations decide what data a tag can see. Google's transformations documentation describes them as controls that run after the client has built the event data object and before tags read it. There are three types:

  • Allow parameters: exposes only the parameters you list. Parameters not explicitly defined are discarded, including parameters Google tags need, so you must check your tags first.
  • Exclude parameters: removes the parameters you list so tags cannot use them.
  • Augment event: changes the value of existing parameters or adds new ones, using a fixed value or a variable.

Each transformation has Affected Tags, which can be all tags (the default), tag types or individual tags, and Matching Conditions, which control when it runs. Without conditions it always runs. The default order of execution is Allow, then Augment, then Exclude, and you can assign a priority to change it.

Design principle: allow-list for ad platforms

For the GA4 tag, an exclude approach is often enough. You trust your own analytics property more than a third-party ad pixel, and you still want the full parameter set for analysis. For advertising tags (Google Ads conversion, Meta, LinkedIn, anything else) use an allow-list.

An allow-list reverses the default. A new parameter added by a developer next year does not reach the ad platform until someone adds it to the list. In a healthcare context that is the right direction of failure.

Decide the permitted fields for each platform on one page:

Platform tagPermitted eventsPermitted parameters
Google Ads conversiongenerate_lead, call_clickevent name, conversion value if used, click ID, timestamp
Meta taggenerate_lead onlyevent name, event ID for deduplication
LinkedIn or othersThe one conversion you pay to optimiseevent name
GA4Full approved taxonomyAll approved parameters, minus excluded fields

The precise parameter names depend on each tag template. Check what each template reads and what happens if a parameter is missing. Google's transformation documentation notes that transformations affect only tags that fire, and that a transformation which removes required fields can stop a tag from firing. Test, do not assume.

A worked rule set

This is a hypothetical rule set for a multi-specialty hospital. Names are illustrative; adapt them to your tracking plan.

Rule 1: Allow parameters, affected tag: the Meta tag. Allow only the event name, an event ID for deduplication, a timestamp and the click identifier your tag template requires. Everything else, including page URL, page title, referrer and department, is discarded for this tag.

Rule 2: Exclude parameters, affected tag: all advertising tags. Remove page_title, search_term, doctor_id, form_type and step_name. This is a second layer. If someone later edits Rule 1 carelessly, the sensitive fields are still removed.

Rule 3: Augment event, affected tags: all tags. Overwrite page_location with a sanitised value from a server-side variable that strips the query string except an allow-list (utm_source, utm_medium, utm_campaign, utm_content, gclid). A tag that reads page_location then receives a clean URL.

Rule 4: Exclude parameters, matching condition: consent state. Google's own example removes custom dimensions when the gcs value shows analytics storage is denied. Mirror that idea: when the consent signal says advertising consent is denied, exclude user-level fields and let only anonymous measurement pass.

Rule 5: Event gating with triggers. The Meta tag fires only on generate_lead. The Google Ads conversion tag fires on generate_lead and call_click. No ad tag fires on page_view or doctor_profile_view.

Together, the effect is that a page view on a department page never leaves your server for an advertising platform, and a lead event carries only an identifier and a timestamp.

Remarketing and sensitive audiences

Some platforms use page views to build remarketing audiences. Google's personalised advertising policy lists health among sensitive interest categories and says advertisers promoting in these categories cannot use advertiser-curated audiences, including Customer Match. Filtering does not make an otherwise prohibited audience acceptable. It is a way to make sure the data never reaches a platform that you do not want building such audiences. Our post on healthcare remarketing strategies covers what is still available.

Want this applied to your practice? Get a free analytics audit.

Book my free audit

What the server can see that you may not have planned for

A server container receives more than the event parameters. Think through:

  • IP address and user agent. Whether and how they are forwarded depends on the tag and its settings. Read each tag's documentation and test the outgoing request in preview.
  • Cookies and client identifiers. First-party cookie values arrive in the request. Decide which identifiers a platform should receive.
  • Request headers and the referrer. Useful for debugging, but they can carry the full URL.
  • Logs. Request logging can record URLs with query strings. The Cloud Run setup guide explains how to exclude request logging with Logs Router filters.

A transformation does not erase anything from the server's own memory or logs. It only controls what tags can read.

Testing: prove the filter works

Use the server container's preview mode, not the live property.

  1. Trigger a test lead from a page with a long query string and a made-up name in the URL, in a test environment.
  2. Open the incoming request in server preview and select the fired tag. The tag details list the transformations that ran and their order.
  3. Open Event Data. Google's documentation says you can compare the values after transformations with the originals using "Show Original".
  4. Confirm the outgoing request to each platform in the tag's request details. Check URL parameters, headers and body.
  5. Repeat with consent denied and consent granted.
  6. Repeat for each event the tag should ignore, and confirm it does not fire.

Keep a screenshot or exported record of the test with the date. It becomes your evidence if a regulator, client or auditor asks how ad platforms are prevented from receiving identifiers.

Failure modes

  • Allow list too narrow. The tag stops firing or conversions stop matching. Fix by adding the one parameter the tag needs, after confirming it is not sensitive.
  • Order surprises. Allow runs before Augment, so a parameter created by an Augment rule can be discarded on the next pass if it is not on the allow-list. Set priorities deliberately.
  • Variables that change. Transformation variables are evaluated each time the rule runs, so a variable that depends on cookies can produce different values on different events.
  • Rules attached to the wrong tag set. Affected Tags defaults to all tags. A rule meant for Meta that silently applies to the GA4 tag will break your analytics.
  • Silent drift. A new tag added by a vendor inherits all-tags rules but none of the allow-lists. Review the tag list monthly.

Documenting the rules so they survive staff changes

A rule set that only one analyst understands will decay. Keep a short register with one row per transformation: its name, type, affected tags, matching conditions, the reason it exists and the date it was last tested. The reason column is the one people skip, and it is the one that matters when a vendor asks you to relax a rule to make a pixel work.

Name transformations so the purpose is visible in the list, for example "Meta: allow-list lead fields" or "All ads: exclude sensitive dimensions". Avoid names like "Rule 3". When a platform's tag template changes and starts reading a new field, you want to know at a glance which rule to revisit.

Agree a change process. A new tag, a new event or a change to any transformation should be reviewed by someone who understands both the marketing intent and the data protection constraints, ideally the person who owns the tracking plan. For a hospital group, that reviewer might sit in the digital team with an escalation route to the data protection lead. Small clinics can do this with a two-person rule: the person who makes the change does not approve it.

Finally, schedule a quarterly replay. Take the original test lead from your preview records, run it again, and compare the outgoing requests with the saved record from the previous quarter. Differences are either deliberate changes, which should appear in the register, or drift, which should not exist.

Where to start

  1. Write the one-page table of permitted events and fields per platform.
  2. Convert each advertising tag to an allow-list and gate it with a trigger.
  3. Add an exclude rule for sensitive fields across all advertising tags as a second layer.
  4. Sanitise page_location with an Augment rule.
  5. Test in preview, with consent granted and denied, and keep dated records.
  6. Review the rule set when a tag or event is added.

For help designing the measurement layer, see our analytics and tracking service. The legal background is in the DPDP Act and healthcare marketing.

Filed underserver side tagging data filteringGTM server transformationssGTM exclude parametersserver-side tagging allow listremove identifiers server sidead platform data minimisation

About the author

Co-Founder & CTO · Gurugram, India

Arush builds the systems the rest of the company runs on — the patient-acquisition pipelines, the AI chatbots, the analytics that tie a single click to a booked appointment. If a campaign reports a number, it's because something his team built is tracking it.

Free guide · 15 pages

The Patient Acquisition Blueprint

A 90-day plan from first search to booked appointment.

The Pioneers Brief — one essay, three benchmarks, one teardown, every Thursday. Subscribe free →

Free analytics audit

Your next chapter starts with a conversation.

Three quick questions. We come prepared with a plan for your specialty and city.

  • A 30-minute call with a healthcare specialist
  • Your top three growth opportunities, in writing
  • Honest advice — even if that means not hiring us
  • No obligation and no hard sell
You’ll speak with a senior strategist
Consultations are hosted by Arush Thapar’s team.
Step 1 of 3Takes 30 seconds

What do you want to improve first?

Details stay privateNo obligationReply within 1 working day

Client portfolio · Healthcare websites

Work relevant to server side tagging filters stripping identifiers before data.

Explore client work →