本文へ移動
cccskills
無料GitHub で公開

server-side-tracking

Implementing server-side tracking with privacy controls using Google Tag Manager server containers. Covers first-party data collection, IP anonymization, consent-aware event forwarding, and reducing client-side third-party cookie exposure.

インストール方法を見る

含まれるファイル(5)

  • SKILL.md9.5 KB
  • assets/template.md1.7 KB
  • references/standards.md2.0 KB
  • references/workflows.md2.4 KB
  • scripts/process.py8.8 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Server-Side Tracking with Privacy Controls

Overview

Server-side tracking moves data collection from the user's browser to a server-controlled environment, providing greater control over what data is shared with third parties. Instead of loading third-party JavaScript directly in the browser (which sets third-party cookies and sends data to external servers without intermediation), a server-side container receives events from the client, processes them, and selectively forwards data to analytics and advertising endpoints. This architecture enables IP anonymization before data leaves the first-party infrastructure, consent-based routing of events, and reduced reliance on third-party cookies — directly supporting ePrivacy Directive Article 5(3) compliance and data minimization under GDPR Article 5(1)(c).

Architecture

Client-Server Flow

User's Browser
    │
    ├── Client-side GTM container (minimal)
    │   └── Sends events to first-party endpoint
    │
    ▼
First-Party Server Endpoint
(https://data.pinnacle-ecommerce.com)
    │
    ├── Server-side GTM container
    │   ├── Validates consent state
    │   ├── Anonymizes IP address
    │   ├── Strips unnecessary identifiers
    │   ├── Applies data minimization rules
    │   │
    │   ├── [If analytics consent granted]
    │   │   └── Forward to Google Analytics 4
    │   │
    │   ├── [If advertising consent granted]
    │   │   ├── Forward to Google Ads
    │   │   ├── Forward to Meta Conversions API
    │   │   └── Forward to other ad platforms
    │   │
    │   └── [If all consent denied]
    │       └── Log aggregate pageview count only (no PII)
    │
    └── First-party server logs (retention: 90 days)

Infrastructure Setup for Pinnacle E-Commerce Ltd

Server Container Hosting Options:

OptionProviderMonthly Cost (est.)LatencyControl
Google Cloud RunGoogle CloudEUR 50-200LowHigh
AWS App RunnerAmazon Web ServicesEUR 40-180LowHigh
Custom DockerSelf-hostedEUR 30-150VariesMaximum
Stape.ioManaged serviceEUR 20-100LowMedium

Pinnacle E-Commerce Ltd Configuration:

SettingValue
Server container URLhttps://data.pinnacle-ecommerce.com
Custom domaindata.pinnacle-ecommerce.com (CNAME to container)
Container regioneurope-west1 (Belgium) — co-located with EU users
ScalingMin 1 instance, max 10 instances
SSL certificateLet's Encrypt via managed certificate
First-party cookie domain.pinnacle-ecommerce.com

Custom Domain for First-Party Context

Using a subdomain of the main site domain ensures:

  • Cookies set by the server container are first-party cookies
  • Requests to data.pinnacle-ecommerce.com are same-site, avoiding third-party cookie restrictions
  • Safari ITP and Firefox ETP do not apply cross-site tracking protections

DNS Configuration:

data.pinnacle-ecommerce.com  CNAME  server-container-abc123.run.app

Consent-Aware Event Forwarding

Consent Validation on the Server

Every event arriving at the server container includes the consent state from the client. The server validates this before forwarding:

Event Payload from Client:

{
  "client_id": "1234567890.1709000000",
  "event_name": "purchase",
  "event_params": {
    "transaction_id": "TXN-2026-0314-001",
    "value": 149.99,
    "currency": "EUR",
    "items": [{"item_id": "SKU-001", "item_name": "Widget Pro"}]
  },
  "consent_state": {
    "analytics_storage": "granted",
    "ad_storage": "denied",
    "ad_user_data": "denied",
    "ad_personalization": "denied"
  },
  "user_agent": "Mozilla/5.0...",
  "ip_address": "203.0.113.42"
}

Server-Side Routing Logic:

DestinationRequired ConsentData Sent
GA4 Measurement Protocolanalytics_storage: grantedEvent name, params, anonymized client_id
Google Ads Conversion APIad_storage + ad_user_data: grantedConversion data, gclid, hashed email
Meta Conversions APIad_storage + ad_user_data: grantedEvent data, fbp, hashed email/phone
Aggregate counter (internal)None required+1 to event type counter (no PII)

IP Anonymization

The server container anonymizes IP addresses before forwarding to any third party:

Anonymization Rules:

MethodDescriptionUse Case
IPv4 last octet zeroing203.0.113.42 → 203.0.113.0Standard GA4 anonymization
IPv6 last 80 bits zeroing2001:db8::1234:5678 → 2001:db8::IPv6 anonymization
Full IP removalIP not forwarded at allMaximum privacy (Meta CAPI)
Geolocation-onlyResolve to country/region, discard IPGeo reporting without IP

Pinnacle E-Commerce Ltd Policy:

  • GA4: Forward anonymized IP (last octet zeroed) for geographic reporting
  • Google Ads: Forward anonymized IP for conversion geo-attribution
  • Meta CAPI: Do not forward IP; send hashed email only (with ad_user_data consent)
  • Internal logs: Retain full IP for 24 hours for security/fraud detection, then anonymize

Data Minimization at the Server Layer

The server container strips data before forwarding:

Data ElementRetained for GA4Retained for AdsRetained Internally
Full URLPath only (no query params)Path onlyFull URL (90 days)
User agentReduced UA (SEC-CH-UA)Reduced UAFull UA (24 hours)
IP addressAnonymizedAnonymizedFull (24 hours)
ReferrerDomain onlyDomain onlyFull (90 days)
Client IDGA client_idgclid/wbraid onlyInternal session ID
Email (hashed)Not sentSHA-256 hashNot stored

Server-Side Tag Configurations

GA4 Server-Side Tag

SettingValue
Measurement IDG-PINNACLE123
API SecretStored in Secret Manager
Send toGA4 Measurement Protocol
IP anonymizationEnabled (default in GA4)
Client ID sourceFirst-party _ga cookie
Session ID sourceFirst-party ga* cookie

Meta Conversions API Tag

SettingValue
Pixel ID123456789012345
Access TokenStored in Secret Manager
Event deduplicationevent_id matches browser Pixel event_id
Data sentEvent name, event_time, action_source, hashed email
IP forwardingDisabled
User agent forwardingReduced UA only

First-Party Cookie Management

The server container can set first-party cookies via Set-Cookie headers, giving them longer lifetimes than client-side JavaScript cookies (which Safari ITP caps at 7 days):

CookieSet ByDurationPurpose
_gaServer (Set-Cookie header)2 yearsGA4 client identifier
_ga_PINNACLEServer (Set-Cookie header)2 yearsGA4 session persistence
_fbcServer (Set-Cookie header)90 daysMeta click identifier
_pin_sessServer (Set-Cookie header)30 minutesInternal session tracking

All cookies above are set only when the corresponding consent category is granted.

Monitoring and Debugging

Server Container Health Checks

MetricTargetAlert Threshold
Request latency (p99)< 200ms> 500ms
Error rate< 0.1%> 1%
Event throughputBaseline +/- 20%> 30% deviation
Consent validation failures0> 0
Forwarding failures (GA4)< 0.5%> 2%
Forwarding failures (Meta)< 1%> 5%

Data Flow Audit

Monthly audit of server-side tracking:

  1. Compare client-side events sent vs. server-side events received (expect < 2% loss)
  2. Verify consent state is correctly parsed for all forwarded events
  3. Confirm no PII is forwarded to destinations where consent is denied
  4. Check that IP anonymization is applied before all third-party forwarding
  5. Validate first-party cookie durations match policy
  6. Review server logs for any unexpected outbound connections

Key Legal and Technical References

  • ePrivacy Directive 2002/58/EC, Article 5(3) — Consent for device storage/access; server-side cookies still require consent if non-essential
  • GDPR Article 5(1)(c) — Data minimization principle; server-side filtering reduces data shared with third parties
  • GDPR Article 28 — Data processor requirements for server hosting providers
  • GDPR Article 44-49 — Transfer restrictions if server container is outside EEA
  • Google Tag Manager Server-Side Documentation — Container setup and tag configuration
  • Meta Conversions API Documentation — Server-side event forwarding for Meta advertising
  • Safari Intelligent Tracking Prevention (ITP) — Client-side cookie limitations driving server-side adoption
  • CNIL Deliberation No. 2020-091 — Server-set cookies still subject to consent requirements

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Implements 42 CFR Part 2 protections for substance use disorder patient records. Covers written consent requirements stricter than HIPAA, re-disclosure prohibition, court order procedures, qualified service organization agreements, and 2024 amendments aligning Part 2 with HIPAA. Keywords: 42 CFR Part 2, substance use disorder, SUD records, re-disclosure, consent, Part 2 amendments.

日本語の概要は準備中です。原文の説明を表示しています。

mukul975/Privacy-Data-Protection-Skills3032026年3月17日 更新

Guides assessment of third-country adequacy decisions under GDPR Article 45 for international data transfers. Covers the current EC adequacy decisions list, adequacy assessment criteria, partial adequacy handling, and monitoring of adequacy decision reviews. Keywords: adequacy decision, Article 45, third country, adequate protection, EC adequacy list.

日本語の概要は準備中です。原文の説明を表示しています。

mukul975/Privacy-Data-Protection-Skills3032026年3月17日 更新

Implements age-gating mechanisms for online services to restrict access based on user age. Covers hard gates versus soft gates, neutral age prompts, re-verification triggers, circumvention prevention, and regulatory requirements under GDPR, COPPA, UK Online Safety Act, and DSA. Keywords: age gate, age restriction, neutral prompt, children, online services, access control.

日本語の概要は準備中です。原文の説明を表示しています。

mukul975/Privacy-Data-Protection-Skills3032026年3月17日 更新

Evaluates and implements age estimation and verification technologies for online services. Covers facial age estimation, digital ID verification, self-declaration with risk assessment, AI-based age estimation, and the accuracy versus privacy tradeoff. Includes ICO guidance and euCONSENT framework. Keywords: age verification, age estimation, facial analysis, digital ID, children, online safety.

日本語の概要は準備中です。原文の説明を表示しています。

mukul975/Privacy-Data-Protection-Skills3032026年3月17日 更新

Preparing EU AI Act compliance documentation for high-risk AI systems. Covers Annex III classification, technical documentation under Art. 11, conformity assessment, risk management systems, and CE marking requirements. Keywords: EU AI Act, high-risk AI, Annex III, conformity assessment, CE marking.

日本語の概要は準備中です。原文の説明を表示しています。

mukul975/Privacy-Data-Protection-Skills3032026年3月17日 更新

Implements GDPR Art. 22 automated decision-making and AI Act Art. 14 human oversight requirements for AI systems. Covers identification of solely automated decisions, meaningful human intervention design, logic explanation mechanisms, and contestation procedures. Keywords: Art. 22, automated decision, human oversight, AI Act, profiling, contestation.

日本語の概要は準備中です。原文の説明を表示しています。

mukul975/Privacy-Data-Protection-Skills3032026年3月17日 更新

mukul975 のスキルをすべて見る

このスキルの問題を報告する