mukul975/privacy-data-protection-skills

server-side-tracking

- Implementing server-side tracking with privacy controls using Google Tag Manager server containers.

소스 보기

사용 방법

  1. 설치 명령을 복사하고 자신의 에이전트 환경에 설치하기 전에 소스 패키지를 확인하세요.
  2. 필요한 도구, 인증 정보, 지원 환경은 원본 문서에서 확인하세요.
  3. 입력과 원하는 산출물을 설명하고 출처와 결과를 대조하세요.
npx skills add https://github.com/mukul975/privacy-data-protection-skills --skill server-side-tracking

시작 전 확인

  • 설치에는 모델 구독, API 한도, 파일 접근 권한이 포함되지 않습니다.
  • 별점 수와 설치 수는 활동 지표이며 독립적인 품질·보안 검증이 아닙니다.
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

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:

json
{
  "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 APIadstorage + aduser_data: grantedConversion data, gclid, hashed email
Meta Conversions APIadstorage + aduser_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 aduserdata 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 deduplicationeventid matches browser Pixel eventid
Data sentEvent name, eventtime, actionsource, 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
gaPINNACLEServer (Set-Cookie header)2 yearsGA4 session persistence
_fbcServer (Set-Cookie header)90 daysMeta click identifier
pinsessServer (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

관련 작업

같은 저장소의 Skills

더 많은 Skills

모든 Skills
mukul975
커뮤니티

applying-privacy-design-patterns

- Systematic application of the eight privacy design patterns per Hoepman: minimize, hide, separate, abstract, inform, control, enforce, and demonstrate. Covers pattern selection methodology per processing activity, mapping to GDPR principles, and practical implementation guidance for privacy-by-design system architecture.

설치 수
1
GitHub Stars
315
업데이트
3월 16일
mukul975
커뮤니티

brazil-lgpd

- Guides compliance with Brazil's Lei Geral de Proteção de Dados (LGPD, Lei 13.709/2018). Covers the 10 lawful bases under Art. 7, DPO appointment, ANPD enforcement, data subject rights under Arts. 17-22, and international transfer mechanisms. Keywords: LGPD, Brazil data protection, ANPD, lawful bases, data subject rights, international transfers.

설치 수
1
GitHub Stars
315
업데이트
3월 16일
mukul975
커뮤니티

adequacy-assessment

- 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.

설치 수
1
GitHub Stars
295
업데이트
3월 16일
mukul975
커뮤니티

age-gating-services

- 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.

설치 수
1
GitHub Stars
295
업데이트
3월 16일