PHPackages                             vizuh/craft-clicktrail - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. vizuh/craft-clicktrail

ActiveCraft-plugin

vizuh/craft-clicktrail
======================

Attribution connector for Craft Forms and Commerce - see which campaign, keyword, click ID and landing page created each submission, customer and order.

v0.1.0(yesterday)00[2 issues](https://github.com/vizuh/clicktrail-craft/issues)MITPHPPHP &gt;=8.2CI passing

Since Aug 24Pushed todayCompare

[ Source](https://github.com/vizuh/clicktrail-craft)[ Packagist](https://packagist.org/packages/vizuh/craft-clicktrail)[ RSS](/packages/vizuh-craft-clicktrail/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

English | [Português](README.pt-BR.md) | [Deutsch](README.de.md) | [中文](README.zh-CN.md)

**vizuh/craft-clicktrail**

See which campaign, keyword, click ID and landing page created each form submission, customer and Commerce order in Craft CMS.

[![CI](https://github.com/vizuh/clicktrail-craft/actions/workflows/ci.yml/badge.svg)](https://github.com/vizuh/clicktrail-craft/actions/workflows/ci.yml)[![Packagist Version](https://camo.githubusercontent.com/a0960d4e0d2ac31731385001c2eff2570ef22809d26374bca5e6f502fb2ba2cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76697a75682f63726166742d636c69636b747261696c)](https://packagist.org/packages/vizuh/craft-clicktrail)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Index
-----

[](#index)

- [Why](#why)
- [Installation](#installation)
- [Quick start](#quick-start)
- [Event mapping](#event-mapping)
- [Settings](#settings)
- [Consent](#consent)
- [Delivery](#delivery)
- [How it differs](#how-it-differs)
- [Testing](#testing)
- [License](#license)

Why
---

[](#why)

Not another analytics script. ClickTrail attaches deterministic first-touch / last-touch attribution to every lead and sale your Craft site produces and ships it server-side to your ClickTrail endpoint — so the answer to "where did this customer come from?" lives next to the record, not in a separate dashboard.

Attribution logic is never reimplemented here; the shared [`clicktrail/php-sdk`](https://github.com/vizuh/clicktrail-php) core computes every payload.

Requires Craft CMS 5.0+ and PHP 8.2+. Optional: the Craft Forms plugin (form submissions) and Craft Commerce (orders).

Installation
------------

[](#installation)

```
composer require vizuh/craft-clicktrail
```

Then install from Settings → Plugins, or:

```
php craft plugin/install clicktrail
```

Quick start
-----------

[](#quick-start)

Read attribution directly in any site template:

```
{{ clicktrail.attribution.first.source }}
{# "google" right after a paid-search landing —
   and still "google" after any number of later direct visits #}

{{ clicktrail.payload('page_view') | json_encode(constant('JSON_PRETTY_PRINT')) }}
{# canonical flat payload: schema_version-stamped, dotted attribution.* keys,
   consent snapshot included. Renders [] when analytics consent is unknown/denied. #}
```

A visitor arrives from a Google Ads ad, registers, then completes a Commerce order. Your ClickTrail endpoint receives three canonical events — `lead.submitted`, `lead.submitted`, `sale.completed` — each stamped with the same immutable first touch (`attribution.first.source === 'google'`, click ID preserved) plus the last touch at event time.

Event mapping
-------------

[](#event-mapping)

Platform-native events map onto canonical ClickTrail events:

Craft eventClickTrail eventForm submit (Forms plugin)`lead.submitted`User registration`lead.submitted`Commerce order completed`sale.completed`Commerce order refunded`sale.refunded`Each mapping can be switched off individually in the settings.

Settings
--------

[](#settings)

All options live on the plugin settings page (Settings → ClickTrail):

SettingDefaultPurposeSite IDemptyIdentifies this site to your ClickTrail accountEndpoint URLemptyWhere payloads are POSTedConsent resolver classemptyCustom `ConsentResolverInterface` implementation returning the normalized snapshot; empty = all signals "unknown"Attribution persistence requires `analytics_storage`onStore nothing without granted analytics consentAd click-ID storage requires `advertising_storage`onStrip gclid/fbclid/... from storage without advertising consentSend hashed lead data to ad destinations (`ad_user_data`)offExtra gate for hashed-lead forwarding; still needs `ad_user_data` grantedFirst-party proxyoffServe the ClickTrail loader from your own domainMap form submissionsonEmit `lead.submitted` on form submitsMap user registrationsonEmit `lead.submitted` on registrationMap Commerce ordersonEmit `sale.completed` on order completionMap refundsonEmit `sale.refunded`Consent
-------

[](#consent)

ClickTrail does not replace your consent platform — it obeys it. The normalized consent contract (capabilities, snapshot shape, behavior matrix) lives in [`docs/consent-compatibility-plan.md`](../../docs/consent-compatibility-plan.md).

- Provider: implement `ClickTrail\Craft\Services\Consent\ConsentResolverInterface` (returns the current `ClickTrail\Consent\ConsentSnapshot`) and point the plugin setting at it. Real CMP adapters are deferred; the WordPress plugin reads WP Consent API directly.
- On unknown consent: **do not store or send**. Suppressed actions are recorded with `suppressionReason()` into diagnostics.
- The resolved snapshot is persisted alongside the attribution state and travels with every event (`consent` key on each payload).

Delivery
--------

[](#delivery)

Payloads are POSTed as JSON to `/events`. Failed deliveries are logged as warnings so nothing disappears silently. Full transport (retries with backoff, idempotency keys) belongs to the shared SDK client once its wiring lands.

How it differs
--------------

[](#how-it-differs)

Typical analytics setupClickTrail for CraftSessions and pages in a dashboardCampaign, keyword, click ID and landing page **on each submission, customer and order**Client-side tags you maintain yourselfOne Twig variable, one first-party loaderAttribution logic duplicated per platformOne deterministic engine, fixture-tested across WordPress, GTM and PHP integrationsTesting
-------

[](#testing)

GitHub Actions CI lints all PHP files on every push ([workflow](https://github.com/vizuh/clicktrail-craft/blob/main/.github/workflows/ci.yml)).

License
-------

[](#license)

MIT — Copyright (c) 2026 Vizuh OÜ. See [LICENSE](LICENSE).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20295730?v=4)[Hugo ](/maintainers/Atroci)[@Atroci](https://github.com/Atroci)

---

Top Contributors

[![Atroci](https://avatars.githubusercontent.com/u/20295730?v=4)](https://github.com/Atroci "Atroci (10 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

analyticsattributionclickstreamcmscommerceconsent-managementconversion-trackingcraft-cmscraft-pluginfirst-party-dataform-submissionsgdprlead-generationmarketing-analyticsphputmmarketinganalyticscraftcmscommerceUTMattributiongclid

### Embed Badge

![Health badge](/badges/vizuh-craft-clicktrail/health.svg)

```
[![Health](https://phpackages.com/badges/vizuh-craft-clicktrail/health.svg)](https://phpackages.com/packages/vizuh-craft-clicktrail)
```

###  Alternatives

[craftcms/commerce

Craft Commerce

240429.5k222](/packages/craftcms-commerce)[spicyweb/craft-neo

A Matrix-like field type with block hierarchy

393818.3k12](/packages/spicyweb-craft-neo)[craftcms/feed-me

Import content from XML, RSS, CSV or JSON feeds into entries, categories, Craft Commerce products, and more.

292960.7k38](/packages/craftcms-feed-me)[verbb/formie

The most user-friendly forms plugin for Craft.

101400.6k79](/packages/verbb-formie)[verbb/hyper

A user-friendly links field for Craft.

24153.5k15](/packages/verbb-hyper)[verbb/vizy

A flexible visual editor field for Craft.

4251.5k1](/packages/verbb-vizy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
