# ppl/module-tracking

> Privacy-first behavioural tracking, consent management and EU/DE data-subject-rights tooling. Requires Ppl_Hub and remains independent of search and filter modules.

`composer require ppl/module-tracking`

Canonical URL: https://packagento.com/ppl/module-tracking

## At a glance

- **Vendor**: Pawel Pliousnin Digital Solutions (https://packagento.com/ppl.md)
- **Latest version**: 1.2.0 — released 2026-07-08
- **Pricing**: $39.00/year, subscription
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

This is a paid package. The Packagento install flow is licence-gated, so a Composer install needs a licence + project + project credentials in place first.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Purchase the package.** Open https://packagento.com/ppl/module-tracking, add it to your cart, and complete checkout. A licence is minted automatically once payment clears.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require ppl/module-tracking:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Privacy-first behavioural tracking, consent management and EU/DE data-subject-rights tooling. Requires Ppl_Hub and remains independent of search and filter modules.

## README

PPL Tracking adds privacy-first behavioural tracking, GDPR/DSGVO consent management and EU/DE data-subject-rights tooling. It records search, click and purchase signals, aggregates them on a schedule, and exposes the result to other PPL modules through neutral Hub events — without a hard dependency on any search or filter module.

### What It Adds
- Consent-gated browser behavioural collector (search executions, result impressions, clicks) with fixed-window rate limiting and event de-duplication
- Server-side purchase and return signals from `sales_order_place_after` and `sales_order_creditmemo_save_after`
- Scheduled behaviour, query and query/product aggregation with a daily raw-event purge
- GDPR/DSGVO consent capture, append-only consent audit, Do-Not-Track handling and configurable PII redaction
- Data-subject-rights CLI tooling for export and erasure
- Neutral behaviour, product and zero-result signal provider events for optional consumers (e.g. Search Intelligence)

### Requirements And Dependencies
- PHP: >=8.1
- Magento packages: magento/framework, magento/module-backend, magento/module-config, magento/module-cookie, magento/module-customer, magento/module-cron, magento/module-sales, magento/module-store
- PPL packages: ppl/module-hub

### Installation
Install the required PPL packages in dependency order. Composer will skip packages that are already installed:

```bash
composer require ppl/module-hub ppl/module-tracking
bin/magento module:enable Ppl_Hub Ppl_Tracking
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
```

Manual app/code installation: copy the dependency modules and this module into `app/code/Ppl` in this order: `Ppl/Hub -> Ppl/Tracking`. Then run the same Magento commands starting with `bin/magento module:enable`.

### First Use
- Open the admin configuration and enable behavioural tracking.
- Decide the consent policy: whether to require consent before tracking and whether to store the customer ID. The browser Do-Not-Track header is always honoured.
- Set the analytics privacy options (query PII redaction, maximum query length) and the raw-event retention window.
- Let the aggregation cron run before judging analytics output.

Admin entry: `PPL Hub > Tracking & Privacy`.

### Configuration
Configuration is available under `PPL Hub > Tracking & Privacy` (Stores > Configuration > PPL > Tracking & Privacy):
- General — enable behavioural tracking.
- Consent (GDPR / DSGVO) — require consent before tracking; the browser Do-Not-Track header is always honoured.
- Privacy — store customer ID, redact PII from query analytics, maximum query length kept for analytics.
- Retention — raw event retention in days; older raw events are purged by cron.

### Command Line
- `bin/magento ppl:tracking:gdpr:export` — export the stored data for a data subject.
- `bin/magento ppl:tracking:gdpr:erase` — erase the stored data for a data subject and rebuild affected aggregates.

### Scheduled Tasks
- `ppl_tracking_aggregate_behavior` — aggregates raw events into behaviour, query and query/product statistics (every 30 minutes).
- `ppl_tracking_purge_raw_events` — purges raw events older than the configured retention window (daily).

### Privacy And Data Subject Rights
- Tracking is consent-gated and can be configured to require explicit consent, and always honours the browser Do-Not-Track header.
- Consent decisions are recorded in an append-only consent audit trail.
- Query analytics can redact PII and cap the stored query length.
- Export and erasure are available through the data-subject-rights CLI commands; raw events are deleted and the affected aggregates are rebuilt from the remaining data.

### Integrations And Boundaries
- Provides neutral behaviour, product and zero-result signals to optional consumers through the `ppl_behavior_signals_collect`, `ppl_product_search_signals_collect` and `ppl_zero_result_queries_collect` events. Consumers such as Ppl_SearchIntelligence can use these signals, but Tracking does not depend on them.
- Remains independent of PPL search and filter modules; it requires only Ppl_Hub for the shared admin navigation.
- Stable: run the documented PPL release gates (setup:upgrade, di:compile, PHPUnit, SCD, production mode) in your environment before publishing this package.

### Localization
The package includes translation CSV files for 12 locales: de_DE, en_US, es_ES, fr_FR, it_IT, ja_JP, nl_NL, pl_PL, pt_BR, ru_RU, tr_TR, zh_CN.

### Customer Documentation
Customer-facing User Guides and Marketplace Long Descriptions are maintained outside the Magento module package in the repository-level `docs/user_guides` and `docs/long_descriptions` folders. The module package itself intentionally keeps only this technical README plus developer-relevant files.

### Support
Support contact: pliousnin@ppl-ds.com. Include the module version, Magento version, enabled PPL companion modules, and the relevant admin or storefront screenshot when reporting an issue.

## Changelog

### 1.2.0

- Initial release.
- Added standalone `Ppl_Tracking` module for privacy-first behavioral tracking, consent management and data-subject-rights tooling.
- Added the consent-gated browser collector with fixed-window rate limiting and event de-duplication.
- Added server-side purchase and return signals from Magento sales events.
- Added scheduled behavior, query and query/product aggregation and a daily raw-event purge.
- Added GDPR/DSGVO consent capture, append-only consent audit, Do-Not-Track handling and configurable query PII redaction and retention.
- Added the `ppl:tracking:gdpr:export` and `ppl:tracking:gdpr:erase` CLI commands.
- Added neutral behavior, product and zero-result signal provider events for optional consumers, without a hard dependency on search or filter modules.
- Added the PPL Hub admin page `PPL Hub > Tracking & Privacy` and translation CSV files for 12 locales.

## Recent Versions

| Version | Released |
|---|---|
| 1.2.0 | 2026-07-08 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| ext-hash | * |
| ext-mbstring | * |
| magento/framework | >=103.0.7 <104.0.0 |
| magento/module-backend | >=102.0.0 <103.0.0 |
| magento/module-catalog | >=104.0.0 <105.0.0 |
| magento/module-config | >=101.2.0 <102.0.0 |
| magento/module-cookie | >=100.4.0 <101.0.0 |
| magento/module-cron | >=100.4.0 <101.0.0 |
| magento/module-customer | >=103.0.0 <104.0.0 |
| magento/module-sales | >=103.0.0 <104.0.0 |
| magento/module-store | >=101.1.0 <102.0.0 |
| php | >=8.1 |
| ppl/module-hub | ^1.2 |
| psr/log | ^1.0 \|\| ^2.0 \|\| ^3.0 |
| symfony/console | ^6.4 \|\| ^7.0 |

## Quality

Latest release (1.2.0) passes the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Pass | 0 |  |
| PHPMD | Warning | 2 | 2 rule violations (ExcessiveClassComplexity:2) |
| Cpd | Warning | 1 | 1 duplicated chunk spanning 39 total lines (min-lines=5, min-tokens=70) |
| Composer validate | Info | 1 | valid; 1 advisory note (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | N/A | 0 | no resolvable dependency tree to audit: Your requirements could not be resolved to an installable set of packages. Problem 1 |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Subscription — $39.00/year, auto-renews until cancelled. Includes all minor + patch upgrades within the licensed major. One licence per project; cancelling stops auto-renewal but the existing licence keeps working until its end date.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["ppl/module-tracking"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

Pawel Pliousnin Digital Solutions is a Magento 2 vendor on Packagento. See https://packagento.com/ppl.md for their full catalogue.

