# AI Marketing, Site Insight and asset cache hooks

> Hooks of AI Marketing (contacts, lists, forms, emails, journeys), Site Insight (tracking, privacy, reports, browser API) and the asset cache.

Source: https://www.wpbot.pro/help/dev-marketing-insight-cache-hooks/  
Section: Developers › Hooks  
Updated: 2026-11-26

These modules cover **Reach / Sell** and **Learn** in the [Growth Loop](/help/the-growth-loop/), plus the chatbot's front-end performance.

## AI Marketing

Prefix `qcld_wpbot_marketing/`; the Master module adds `qcld_wpbot_marketing_pro/`.

### Contacts and lists

| Hook | Type | Parameters | What it is for |
| --- | --- | --- | --- |
| `qcld_wpbot_marketing/contact_created` | action | `array $contact`, `string $source` | A new contact was added |
| `qcld_wpbot_marketing/contact_confirmed` | action | `array $contact` | A contact confirmed double opt-in |
| `qcld_wpbot_marketing/contact_status_changed` | action | `array $contact`, `string $old`, `string $by` (owner, chatbot, link …) | A contact's status changed |
| `qcld_wpbot_marketing/contact_unsubscribed` | action | `array $contact`, `$source` | A contact unsubscribed |
| `qcld_wpbot_marketing/contact_deleted` | action | `array $contact` | A contact was deleted |
| `qcld_wpbot_marketing/list_added` | action | `int $contact_id`, `int $list_id`, `string $origin` | A contact joined a list or tag |
| `qcld_wpbot_marketing/list_removed` | action | `int $contact_id`, `int $list_id` | A contact left a list or tag |
| `qcld_wpbot_marketing/chatbot_lead` | action | `int $contact_id`, `array $lead`, `array $result` | A chatbot lead became a contact |
| `qcld_wpbot_marketing/form_submitted` | action | `int $contact_id`, `int[] $groups`, `string $page`, `string $form`, `array $extra` (phone, SMS consent) | Someone used a sign-up form (`$form` is `''` for `[wpbot_subscribe]`) |
| `qcld_wpbot_marketing/subscribe_response` | filter | `array $response`, `$result`, `$form` | The answer a sign-up form shows |

### Sending

| Hook | Type | Parameters | What it is for |
| --- | --- | --- | --- |
| `qcld_wpbot_marketing/send` | filter | `null`, `array $built` (to, subject, html, headers), `array $context` (message\_id, campaign\_id, journey\_id, kind) | Send the email through your own provider: return `true`, `array( 'id' => … )` or a `WP_Error`. `null` lets `wp_mail()` send |
| `qcld_wpbot_marketing/may_send` | filter | `bool $allowed`, `array $contact`, `array $context` | Stop one email to one contact |
| `qcld_wpbot_marketing/email_html` | filter | `string $html`, `array $contact`, `array $email` | The email's HTML before sending |
| `qcld_wpbot_marketing/email_sent` | action | `int $message_id`, `int $contact_id`, `array $row` | An email was sent |
| `qcld_wpbot_marketing/email_engagement` | action | `int $message_id`, `int $contact_id`, `string $type` (`open` or `click`), `array $data`, `array $message` | An email was opened or a link clicked |

### Journeys

| Hook | Type | Parameters | What it is for |
| --- | --- | --- | --- |
| `qcld_wpbot_marketing/journey_triggers` | filter | `string[] $triggers` | Journey triggers: `subscribed`, `list_added`, `tag_added`, `chatbot_lead`, `form_submitted` |
| `qcld_wpbot_marketing/journey_actions` | filter | `string[] $actions` | Steps a journey can take |

### Example: copy new subscribers to another system

```
add_action( 'qcld_wpbot_marketing/contact_created', function ( $contact, $source ) {
	error_log( 'New WPBot contact from ' . $source );
}, 10, 2 );
```

## Site Insight

Prefix `qcin/`; the Pro module adds `qcin/pro/`. Recordings and heatmaps stay on your own server.

| Hook | Type | What it is for |
| --- | --- | --- |
| `qcin/should_track` | filter | Final decision whether to add the tracker to a request |
| `qcin/tracker_config` | filter | Settings sent to the browser |
| `qcin/default_mask_selectors` | filter | Areas hidden in recordings by default (WooCommerce account, order and address pages) |
| `qcin/allowed_query_params` | filter | Query parameters kept in stored addresses |
| `qcin/allowed_origins` | filter | Extra hosts the recording endpoint accepts |
| `qcin/is_bot` | filter | Bot detection |
| `qcin/country` | filter | Country code when no CDN header gives one |
| `qcin/privacy_policy_text` | filter | Suggested privacy policy text |
| `qcin/capability` | filter | Capability per context: `view` (screens) and `settings` |
| `qcin/signal_recorded` | action | A frustration signal was stored (signal, session id, page view id) |
| `qcin/session_finalized` | action | Idle sessions were closed (session ids) |
| `qcin/ai_summary_created` | action | An AI visit summary was stored |
| `qcin/report_sections` | filter | Extra sections in the email report (totals only) |
| `qcin/report_email` | filter | The report email just before it is sent |
| `qcin/report_sent` | action | A report was sent |
| `qcin/raw_click_days` | filter | Days raw clicks are kept (1–90, default 7) |

### Hide parts of a page from recordings

Add the class `qcin-mask` to mask an element's text, or `qcin-block` to leave the element out of recordings entirely; `qcin-unmask` shows text inside a masked area. Every form input is already masked in the browser before anything is sent.

### Browser API

After the tracker has loaded, `window.qcInsights` offers:

| Call | What it does |
| --- | --- |
| `qcInsights.event( name, data )` | Record your own event in the visit |
| `qcInsights.tag( key, value )` | Tag the visit, for example a plan or an A/B variant |
| `qcInsights.on( name, fn )` | Listen to tracker events |
| `qcInsights.getContext()` | Read the current visit context |
| `qcInsights.stop()` | Stop tracking on this page |

## Asset cache

The asset cache serves smaller copies of the chatbot's own scripts and styles (**WPBot Pro → ChatBot → Performance**).

| Hook / function / constant | Type | What it is for |
| --- | --- | --- |
| `wpbot_asset_cache()` | function | The module: `is_active()`, `clear()`, `rebuild()`, `get_status()` |
| `wpbot_asset_cache_handles` | filter | Add or remove script and style handles the cache may process (`['script' => [], 'style' => []]`) |
| `wpbot_asset_cache_skip` | filter | `( $skip, $handle, $type )`: leave one file untouched |
| `wpbot_asset_cache_dir` | filter | `( ['path' => …, 'url' => …], $package )`: move the cache folder |
| `wpbot_asset_cache_minified` | filter | `( $code, $handle, $type )`: adjust a file before it is written |
| `wpbot_asset_cache_cleared` | action | `( $deleted )`: the cache was cleared |
| `qcld_wpbot_ao_detected_plugins` | filter | Caching plugins WPBot detected (`slug => name`) |
| `WPBOT_ASSET_CACHE_DISABLE` | constant | Set to `true` in `wp-config.php` to force the asset cache off |

See [Caching, optimisation plugins and CDNs (WP Rocket, LiteSpeed and more)](/help/ts-compatibility-caching-and-cdn/).

## Availability

- **AI Marketing**  core hooks: every edition, including WPBot Free. `qcld_wpbot_marketing_pro/` hooks: **Master**  only.
- **Site Insight**  core hooks and the browser API: every edition, including WPBot Free. `qcin/pro/` hooks: **Professional**  and **Master** .
- **Asset cache** : every edition, including WPBot Free. The "Load chat engine" and "Save colours and bot settings as files" options come with every WPBot Pro edition.
