WordPress
The WordPress plugin vskstudio/takt-wordpress wraps the PHP core as a drop-in plugin: it injects the snippet into wp_head and — when WooCommerce is active — reports completed orders as server-to-server purchase events. Requires WordPress 6.0+ and PHP 8.1+. This page covers version 0.3.1.
Installation
The plugin ships as a self-contained ZIP — no composer install on the server. Download takt-analytics.zip from the latest release, then in Plugins → Add New → Upload Plugin, upload it and activate.
wp plugin install takt-analytics.zip --activate All dependencies (the PHP core and its PSR-7 stack) are namespaced under Takt\WP\Vendor\, so the plugin never clashes with another plugin’s libraries. Server-to-server requests go through WordPress’ own wp_remote_post — no bundled HTTP client.
Configuration
Everything lives under Settings → Takt Analytics:
| Setting | Description |
|---|---|
| Domain | The site identifier sent with every event (e.g. example.com). |
| Script mode | inline (snippet embedded, anti-adblock), cdn (jsDelivr), asset (a file you host) or sdk (ES module — the only mode that accepts excluded paths and URL scrubbing). |
| Script origin | First-party origin serving the tracker runtime; browser ingest then goes through that origin instead of the Takt domain. |
| Exclude localhost | Skip tracking on local hostnames. Off by default — tick it explicitly, otherwise localhost traffic and the like is counted. |
| Outbound clicks / Downloads / Tagged events / 404 pages | Autocapture toggles for the browser tracker. |
| Download extensions | Restrict counted downloads to these extensions (pdf, zip, docx). Empty = the tracker’s default list. |
| Sample rate | Fraction of hits sent, between 0 and 1 (0.5). Empty = everything is sent. |
| Keep the query string | Keeps the query string and hash in the recorded URL; otherwise they are stripped. |
| Kept query parameters | Allowlist of parameters to keep (utm_source, utm_medium). |
| Excluded paths (SDK mode) | Path prefixes never tracked (/app, /account). Ignored outside sdk mode. |
| Ignore Do-Not-Track | Stop honouring the browser’s Do Not Track signal. |
| Pause tracking | Kill switch: the snippet still renders but sends nothing. |
| WooCommerce tracking (purchases) | Send a purchase event when an order reaches the trigger status. |
| Order trigger | Order status that fires the purchase (Completed or Processing). |
| Ingest endpoint | The Takt ingest origin, with no path — https://taktlytics.com for the hosted service. The plugin appends /api/event itself. Used for server-to-server events only. |
| API key | Bearer token for S2S events — write-only field. |
https://taktlytics.com/api/event in Ingest endpoint: the request URL would become …/api/event/api/event and purchases would never arrive, with no error message.In asset mode the snippet points at /takt/takt.auto.js (prefixed with Script origin when set): dropping that file at this URL is up to you, the plugin does not serve it.
API key via wp-config.php
For environments where secrets must not live in the database, define the key as a constant. It takes precedence over the stored value, and the admin field is disabled (greyed out, not submitted) with a note stating the key comes from the constant:
define('TAKT_API_KEY', 'your-key'); URL scrubbing via wp-config.php
URL rewriting is a raw JS function injected verbatim into the page: it stays developer-controlled and is likewise defined as a constant, never from the admin screen. It only takes effect in sdk mode:
define('TAKT_SCRUB_URL', '(u) => u.split("#")[0]'); CSP
The takt_snippet_nonce filter supplies the CSP nonce set on the snippet’s <script> tag — required in inline mode (the default) under a strict script-src policy:
add_filter('takt_snippet_nonce', fn () => my_csp_nonce()); WooCommerce purchases (server-to-server)
Purchase tracking only starts when all four conditions are met: WooCommerce active, the WooCommerce tracking toggle on, Ingest endpoint filled in and API key filled in. If one is missing, the plugin simply does not register the hook, with no error message.
The plugin then listens to woocommerce_order_status_changed and emits a Purchase event with revenue from your server — so sales are tracked even when the order completes off-session (payment callback, admin, cron), where a browser snippet can’t fire:
// Emitted by the plugin on the trigger status:
$takt->withVisitor($order->get_customer_ip_address(), $order->get_customer_user_agent())
->event('Purchase', ['order_id' => '1234', 'items' => '2'], new Revenue('99.90', 'EUR')); The core classes are renamed under Takt\WP\Vendor\ in the published ZIP: this snippet illustrates what the plugin sends, it is not reusable as-is from a theme.
The customer’s IP and User-Agent from the order are forwarded for attribution. Each order is counted once: the plugin marks the order with a _takt_tracked meta, so a re-entrant status hook (processing → completed, a double click in the admin, a plugin re-saving the order) never reports the same purchase twice. The S2S client swallows transport errors by default, so a failed event never breaks checkout.
Privacy
Purchase events are sent from your server to the Takt ingest origin and include the customer’s IP and User-Agent for attribution. They are forwarded, never logged by the plugin. The browser tracker honours Do Not Track and a takt_ignore localStorage opt-out.