solidwork/contao-solid-ads-tracker-bundle
Composer 安装命令:
composer require solidwork/contao-solid-ads-tracker-bundle
包简介
Tracks visitors from Google Ads (gclid) and Bing Ads (msclkid) and logs them in the Contao 5 backend.
README 文档
README
A Contao 5.3 bundle for automatically tracking visitors who arrive via Google Ads (gclid) or Bing Ads (msclkid).
Features
- Automatic detection of Google Ads clicks (
gclid) and Bing Ads clicks (msclkid) - Stores all hits in a dedicated database table (
tl_solid_ads_visit) - Records all UTM parameters (
utm_source,utm_medium,utm_campaign,utm_term,utm_content) - Backend module under System → Ads Tracker for reviewing all tracked visits
- Date range filter (From / To) with live entry count display
- Dropdown filters by source (Google / Bing), UTM Source, Medium and Campaign
- Full-text search across URL, Click-IDs, UTM parameters, referrer and user agent
- Detail view per entry with all stored fields
- Export filtered data as CSV or JSON (filename includes date, time and active filters)
- Installable via Contao Manager
Installation
Via Contao Manager (recommended)
- Open Contao Manager
- Search for
solidwork/contao-solid-ads-tracker-bundle - Install and update the database
- Run the required setup via SSH (see section below)
Via Composer
composer require solidwork/contao-solid-ads-tracker-bundle
Then create the database table:
php bin/console contao:migrate
⚠️ Required: One-Time Setup
This step is mandatory. Without it, tracking will not work on production Contao installations that use the built-in HTTP cache.
Run the included setup command once after installation:
php bin/console solidwork:ads-tracker:setup php bin/console cache:clear
This command automatically:
- Adds
QUERY_PARAMS_REMOVE_FROM_DENY_LIST=gclid,msclkidto your.env.local - Clears the HTTP cache directory (
var/cache/prod/http_cache/)
Why this is needed
Contao's built-in HTTP cache (ContaoCache) normalizes URLs before checking the cache. By default, it strips tracking parameters like gclid and msclkid:
- A request for
/?gclid=test9999is normalized to/? - If
/?is already cached, the full page is served from cache without the inner application ever seeing thegclid - The tracking listener never fires for the original visitor request
The env variable QUERY_PARAMS_REMOVE_FROM_DENY_LIST=gclid,msclkid prevents this stripping, so each ad click URL gets its own cache entry and the tracking listener is called correctly.
Manual alternative: If you prefer, add
QUERY_PARAMS_REMOVE_FROM_DENY_LIST=gclid,msclkidto.env.localby hand, then runrm -rf var/cache/prod/http_cache/ && php bin/console cache:clear.
Console Commands
Run setup (required once)
Configures .env.local and clears the HTTP cache:
php bin/console solidwork:ads-tracker:setup php bin/console cache:clear
Run database migration
After installation, create the table:
php bin/console contao:migrate
Load demo entries
To test the backend view with sample data:
php bin/console solidwork:ads-tracker:load-fixtures
Creates 10 realistic demo entries (Google Ads & Bing Ads) spread over 60 days. Visible in the Contao backend under System → Ads Tracker afterwards.
Backend Module
The module appears in the Contao backend under System → Ads Tracker.
List View
Displays all tracked visits with the following columns:
| Column | Description |
|---|---|
# |
Entry ID |
| Source | Google Ads or Bing Ads |
| Date & Time | Timestamp of the visit |
| UTM Source | utm_source parameter |
| UTM Medium | utm_medium parameter |
| UTM Campaign | utm_campaign parameter |
| Visited URL | Full URL of the visit |
Date Range Filter
A date range (From / To) can be entered in the top panel. After clicking Apply, the list is restricted to that period. The current entry count is displayed next to the filter:
- Without filter:
13 entries total - With filter:
3 of 13 entries
Dropdown Filters
Filter by the following fields via dropdown:
- Source – Google Ads or Bing Ads
- UTM Source
- UTM Medium
- UTM Campaign
Search
Full-text search across the following fields:
- Visited URL
- Google Click-ID (
gclid) - Bing Click-ID (
msclkid) - UTM parameters
- Referrer
- Browser / User-Agent
Detail View
Clicking the info icon opens the detail view with all stored fields for that entry.
Export
Use the Export CSV and Export JSON buttons to download all currently filtered entries. The export respects all active filters:
- Date range filter (From / To)
- Dropdown filters (Source, UTM Source, UTM Medium, UTM Campaign)
The filename automatically includes the date, time and active filters, e.g.:
ads-tracker_2026-02-27_14-32-05_source-google_utm_campaign-winter2026.csv
ads-tracker_2026-02-27_14-32-05_2026-02-01_bis_2026-02-27.json
How Does Tracking Work?
The bundle registers a Symfony event listener on kernel.request (priority 8). On every GET request it checks for a gclid (Google Ads) or msclkid (Bing Ads) parameter in $_GET. If found, the visit is immediately saved to the database.
AJAX requests are ignored. If an error occurs (e.g. table not yet created), the listener fails silently without affecting the page.
Contao HTTP Cache compatibility
Contao uses a built-in HTTP cache (ContaoCache) in production. Without the QUERY_PARAMS_REMOVE_FROM_DENY_LIST configuration described above, the tracking listener will never be called for ad clicks because:
- Contao strips
gclid/msclkidfrom the URL to create a normalised cache key - The normalised URL (e.g.
/?) likely exists in cache → the cached response is returned directly - The inner Symfony application (and therefore this listener) is never invoked
With the env variable set, each gclid/msclkid URL gets its own cache entry and the full request reaches the tracking listener correctly.
Database Structure (tl_solid_ads_visit)
| Column | Type | Description |
|---|---|---|
id |
INT | Primary key, auto-increment |
tstamp |
INT | Unix timestamp (internal) |
source |
VARCHAR(10) | google or bing |
visited_at |
VARCHAR(20) | Date & time (Y-m-d H:i:s) |
page_url |
TEXT | Full URL of the visited page |
gclid |
VARCHAR(255) | Google Ads Click-ID |
msclkid |
VARCHAR(255) | Bing Ads Click-ID |
utm_source |
VARCHAR(255) | UTM parameter: source |
utm_medium |
VARCHAR(255) | UTM parameter: medium |
utm_campaign |
VARCHAR(255) | UTM parameter: campaign |
utm_term |
VARCHAR(255) | UTM parameter: term |
utm_content |
VARCHAR(255) | UTM parameter: content |
referrer |
TEXT | HTTP referrer header |
user_agent |
TEXT | Browser / user agent |
Requirements
- PHP 8.1 or higher
- Contao 5.3 or higher
License
LGPL-3.0-or-later – see LICENSE
Author
solidwork/contao-solid-ads-tracker-bundle 适用场景与选型建议
solidwork/contao-solid-ads-tracker-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「analytics」 「ads」 「tracking」 「contao」 「bing-ads」 「google-ads」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 solidwork/contao-solid-ads-tracker-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 solidwork/contao-solid-ads-tracker-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 solidwork/contao-solid-ads-tracker-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Facebook & Instagram Ads for Laravel 5.6+
PHP SDK for the Parcel Monkey UK API
A Twitter supported and maintained Ads API SDK for PHP
Origin by Flagrow. Bombarding your users with ads.
Analytics chooser extensions for site settings.
A Laravel Nova Card to show Fathom Analytics stats.
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2026-02-27