{"id":22706593,"url":"https://github.com/optimics/sklik-sgtm-template","last_synced_at":"2026-01-08T02:32:02.722Z","repository":{"id":267333134,"uuid":"900922013","full_name":"optimics/sklik-sgtm-template","owner":"optimics","description":"sGTM Sklik Template Repository","archived":false,"fork":false,"pushed_at":"2024-12-13T10:35:30.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T21:43:08.163Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Smarty","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/optimics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-09T18:04:09.000Z","updated_at":"2024-12-13T10:35:35.000Z","dependencies_parsed_at":"2024-12-09T19:20:22.587Z","dependency_job_id":"bbe5a169-3514-4b2e-948d-729cf46f1105","html_url":"https://github.com/optimics/sklik-sgtm-template","commit_stats":null,"previous_names":["optimics/sklik-sgtm-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimics%2Fsklik-sgtm-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimics%2Fsklik-sgtm-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimics%2Fsklik-sgtm-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimics%2Fsklik-sgtm-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/optimics","download_url":"https://codeload.github.com/optimics/sklik-sgtm-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246243564,"owners_count":20746307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-10T10:09:05.532Z","updated_at":"2026-01-08T02:32:02.693Z","avatar_url":"https://github.com/optimics.png","language":"Smarty","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sklik Server-Side Google Tag Manager Template\n\nThis document provides a comprehensive overview of the Sklik server-side Google Tag Manager (GTM) template, including its configuration options, logic flow, and how it processes conversion and retargeting events.\n\n---\n\n## Overview\n\nThe Sklik GTM server-side template facilitates the sending of conversion and retargeting events to Sklik (Seznam.cz's advertising platform). It uses server-side tagging to enhance data privacy, ensure reliable event tracking, and maintain compatibility with browser restrictions.\n\n---\n\n## Key Functions\n\n- **`logToConsole`**: Logs messages to the server-side console for debugging purposes.\n- **`getRequestHeader`**: Fetches HTTP request headers.\n- **`getEventData`**: Retrieves data from incoming events.\n- **`sendPixelFromBrowser`**: Sends a pixel request back to the browser to preserve third-party cookies and the client’s IP address.\n\n---\n\n## Template Inputs\n\n### Conversion Inputs\n\n- **`conversionId` (Required)**: ID of the conversion event.\n- **`conversionValue` (Optional)**: Value associated with the conversion.\n- **`conversionOrderId` (Optional)**: Unique order ID for the conversion.\n- **`conversionZboziId` (Optional)**: ID for Zbozi.cz (disabled in current implementation).\n- **`conversionZboziType` (Optional)**: Type for Zbozi.cz (disabled in current implementation).\n\n### Retargeting Inputs\n\n- **`retargetingId` (Required)**: ID for the retargeting event.\n- **`retargetingItemId` (Optional)**: Item ID for the retargeting event.\n- **`retargetingPageType` (Optional)**: Type of page for the retargeting event.\n- **`retargetingCategory` (Optional)**: Category for the retargeting event.\n- **`retargetingUrl` (Optional)**: URL for the retargeting event.\n\n### Common Inputs\n\n- **`tagType` (Required)**: Specifies whether the tag is for conversion or retargeting.\n- **`tagConsent` (Required)**: Defines consent logic. Accepted values:\n  - `inherit`: Consent is determined by the `x-ga-gcs` event data.\n  - `granted`: Consent is explicitly granted.\n  - `denied`: Consent is explicitly denied.\n\n---\n\n## Logic Flow\n\n### 1. Initialization\n\n- Logs the start of the template execution.\n- Captures essential event data, including:\n  - **`pageReferrer`**: Referring page URL.\n  - **`consentState`**: Consent signal from the event data (`x-ga-gcs`).\n\n### 2. Tag Type Handling\n\nDepending on `tagType`, the script processes either a **conversion** or **retargeting** event:\n\n#### Conversion\n\n- Constructs the base URL: `https://c.seznam.cz/conv?id=...`\n- Appends optional query parameters (e.g., `value`, `orderId`, etc.).\n\n#### Retargeting\n\n- Constructs the base URL: `https://c.seznam.cz/retargeting?id=...`\n- Appends optional query parameters (e.g., `itemId`, `pageType`, etc.).\n\n### 3. Consent Evaluation\n\n- Evaluates the consent state based on `tagConsent`:\n  - **`inherit`**: Uses the third character of `x-ga-gcs` to determine consent (`1 = granted`, `0 = denied`, `-1 = unknown`).\n  - **`granted`** or **`denied`**: Sets explicit consent values.\n- Appends the consent flag (`consent`) to the destination URL.\n\n### 4. Send Pixel\n\n- Logs the final destination URL.\n- Sends a pixel request to the Seznam.cz server using `sendPixelFromBrowser`.\n\n### 5. Completion\n\n- Calls `data.gtmOnSuccess` to signal successful tag execution.\n\n---\n\n## Destination URL Construction\n\nThe final URL is constructed dynamically based on input values and the tag type. Example formats:\n\n### Conversion:\n```php\nhttps://c.seznam.cz/conv?id=\u0026value=\u0026orderId=\u0026url=\u0026consent=\n```\n\n### Retargeting:\n```php\nhttps://c.seznam.cz/retargeting?id=\u0026itemId=\u0026pageType=\u0026url=\u0026consent=\n```\n\n---\n\n## Error Handling\n\n- If any required input (e.g., `conversionId` or `retargetingId`) is missing, the script will not execute correctly, and debugging logs will indicate the issue.\n- Consent state is handled gracefully, with a default value of `-1` (unknown) if no valid consent signal is found.\n\n---\n\n## Debugging\n\n- Use `logToConsole` messages to trace the script’s execution flow.\n- Check the constructed URLs in the server logs for validation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimics%2Fsklik-sgtm-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foptimics%2Fsklik-sgtm-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimics%2Fsklik-sgtm-template/lists"}