WooAI Analytics Integration Guide

PHP Warning: PHP Startup: Unable to load dynamic library ‘newrelic.so’ (tried: /usr/lib/php/20230831/newrelic.so (/usr/lib/php/20230831/newrelic.so: cannot open shared object file: No such file or directory), /usr/lib/php/20230831/newrelic.so.so (/usr/lib/php/20230831/newrelic.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Docs / Analytics Integration Guide

WooAI Chatbot Pro automatically fires standard events to Google Analytics 4, Meta Pixel, and Mixpanel — simultaneously — every time a shopper interacts with the chat widget. Paste your IDs into Analytics Settings and data starts flowing immediately.

Overview

WooAI Chatbot Pro tracks every chat interaction automatically across all three analytics platforms at the same time. The plugin’s internal Dashboard in WP Admin also records all events independently — it is never blocked by ad-blockers and gives you a reliable baseline even when external SDKs are unavailable.

What you need to do: Go to WP Admin → WooAI Assistant → Analytics Settings, paste your provider IDs, click Save. That’s it — no code edits, no GTM containers, no tag configuration.

Supported providers

ProviderWhat it tracksWhat you get
Google Analytics 4All chat + ecommerce events via window.gtag()Conversions, revenue, funnels, audiences
Meta PixelStandard + custom events via window.fbq()Conversion attribution, retargeting audiences
MixpanelAll events via window.mixpanel.track()Funnels, cohorts, retention, user journeys
Internal DashboardAll events server-side to waa_events DB tableAlways-on baseline, unaffected by ad-blockers

Quick setup

Google Analytics 4

  1. Get your Measurement ID: go to analytics.google.com → Admin → Data Streams → your web stream. The ID is in the format G-XXXXXXXXXX.
  2. In WordPress admin: WooAI Assistant → Analytics Settings → Google Analytics 4 → toggle ON → paste ID → Save.
  3. Optional: Enable the GA4 DebugView mode toggle to see events in real-time during testing. Disable it for production.

Meta Pixel

  1. Get your Pixel ID: go to business.facebook.com → Events Manager. The Pixel ID is 10-16 digits.
  2. In WordPress admin: WooAI Assistant → Analytics Settings → Meta Pixel → toggle ON → paste Pixel ID → Save.

Mixpanel

  1. Get your Project Token: go to mixpanel.com → Settings → Project Settings → Project Token.
  2. In WordPress admin: WooAI Assistant → Analytics Settings → Mixpanel → toggle ON → paste Token → Save.
After saving, events start flowing immediately on the next page load. No cache flush or plugin restart needed.

Verify it works

ProviderHow to verify
GA4 Open Google Analytics → Configure → DebugView. Enable GA4 DebugView toggle in plugin settings, then browse your site and open the chat widget. Events appear within a few seconds.
Meta Pixel Install the free Chrome extension Meta Pixel Helper, then visit your site. The badge shows a count of fired events. Green = working.
Mixpanel Open Mixpanel → Events → Live View. Trigger a chat interaction; events appear within seconds.
Internal Dashboard WP Admin → WooAI Assistant → Dashboard → Conversations. Events are always there regardless of external providers.

Complete event taxonomy

The table below lists every event the plugin fires. Events are fired to all enabled providers simultaneously. Ecommerce events are marked with 🛒.

Note on custom events: Meta Pixel has a limited set of standard events (shown as “standard” below). All other events use Meta’s custom event API under the WooAI* namespace. GA4 uses wooai_* prefix for non-standard events.

Internal event Trigger GA4 Meta Pixel Mixpanel
conversation_start First user message sent in a chat session engage_widget WooAIConversationStart (custom) Chat Started
widget_open User clicks the chat FAB to open the widget widget_open WooAIWidgetOpen (custom) Widget Opened
widget_close User closes the chat widget widget_close WooAIWidgetClose (custom) Widget Closed
message_sent User submits a message in chat chat_message WooAIMessageSent (custom) Message Sent
message_received AI reply delivered to the user chat_response WooAIMessageReceived (custom) Response Received
topic_detected AI classifies the user’s intent/topic topic_detected WooAITopicDetected (custom) Topic Detected
🛒 product_view A single product card is displayed in chat view_item (standard) ViewContent (standard) Product Viewed
🛒 product_click User clicks a product card in chat select_item (standard) ViewContent (standard) Product Clicked
🛒 products_viewed A product list or carousel is shown in chat view_item_list (standard) WooAIProductsViewed (custom) Products Viewed
🛒 add_to_cart User adds a product to cart via chat add_to_cart (standard) AddToCart (standard) Added to Cart
🛒 remove_from_cart User removes a product from cart via chat remove_from_cart (standard) WooAIRemoveFromCart (custom) Removed from Cart
🛒 checkout_start User initiates checkout from chat begin_checkout (standard) InitiateCheckout (standard) Checkout Started
🛒 purchase Order confirmed – chatbot-attributed purchase purchase (standard) Purchase (standard) Purchase Completed
session_start New analytics session created for a visitor session_start (standard) WooAISessionStart (custom) Session Started
session_end Chat session closes (page unload or timeout) session_end WooAISessionEnd (custom) Session Ended
playbook_started A configured playbook scenario begins playbook_started WooAIPlaybookStarted (custom) Playbook Started
playbook_completed A playbook scenario reaches its end node playbook_completed WooAIPlaybookCompleted (custom) Playbook Completed
error Technical error occurs in the chatbot exception (standard) WooAIError (custom) Error Occurred
recommendation_click User clicks a quick-reply recommendation chip wooai_recommendation_click WooAIRecommendationClick (custom) WooAI Recommendation Click
response_thumbs_up User gives a thumbs-up rating to an AI reply wooai_response_thumbs_up WooAIResponseThumbsUp (custom) WooAI Response Thumbs Up
response_thumbs_down User gives a thumbs-down rating to an AI reply wooai_response_thumbs_down WooAIResponseThumbsDown (custom) WooAI Response Thumbs Down
escalation_requested User clicks the WhatsApp / human handoff button wooai_escalation_requested WooAIEscalationRequested (custom) WooAI Escalation Requested

Note on product_view vs products_viewed in Meta Pixel: To avoid double-firing ViewContent events when a product carousel displays multiple products, products_viewed (list-level) fires as a Meta custom event (WooAIProductsViewed), while individual product_view events use the standard ViewContent for retargeting. As of v0.38.19.

Custom event naming rules: GA4 auto-prefixes unmapped events as wooai_*. Meta Pixel auto-formats unmapped events as WooAI<PascalCase>. Mixpanel uses WooAI <Title Case> for unmapped events.

Standard ecommerce event parameters

All four ecommerce events (add_to_cart, view_item, begin_checkout, purchase) send rich product data to every provider. Here is exactly what each platform receives.

Google Analytics 4

Sent via window.gtag('event', eventName, params):

ParameterTypeDescription
currencystringStore currency code – auto-detected from WooCommerce (e.g. ILS, USD, EUR)
valuenumberTotal monetary value (price x quantity, summed across all items)
transaction_idstringOrder ID — purchase event only
items[]arrayArray of product objects (see below)

Per-product fields inside items[]:

FieldTypeDescription
item_idstringWooCommerce product ID
item_namestringProduct name
item_categorystringPrimary product category
item_brandstringProduct brand (if set)
item_variantstringVariant attributes (color, size, etc.)
pricenumberUnit price
quantitynumberQuantity
item_list_namestring"Chat Recommendations" — identifies chatbot as the source list
item_list_idstringInternal list identifier
discountnumberDiscount amount (if applicable)
indexnumberPosition in list (for list-type events)

Meta Pixel

Sent via window.fbq('track', eventName, params):

ParameterTypeEventsDescription
content_idsstring[]AllArray of product IDs
content_namestringViewContent, AddToCartProduct name(s)
content_typestringAllAlways 'product'
valuenumberAddToCart, InitiateCheckout, PurchaseTotal monetary value
currencystringAddToCart, InitiateCheckout, PurchaseStore currency code
num_itemsnumberInitiateCheckoutTotal item count in cart
contentsarrayAddToCart, PurchasePer-item objects with id, quantity, item_price

Mixpanel

Sent via window.mixpanel.track(eventName, properties):

PropertyDescription
sourceAlways 'wooai_chatbot' — identifies chatbot as the attribution source
timestampISO 8601 event timestamp
items[]Full product array (same fields as GA4 items)
item_countTotal quantity of items
valueTotal monetary value
session contextChat session ID, message count, language — appended to all ecommerce events

WooAI integrates with the WordPress Consent API. Compatible CMPs include Complianz, CookieYes, Cookiebot, and any plugin implementing the WP Consent API standard.

  • Analytics events fire only after the visitor accepts analytics/statistics cookies.
  • GA4 Consent Mode v2 is supported: the default state sent before consent is analytics_storage: denied and ad_storage: denied. When the visitor accepts, the CMP calls gtag('consent', 'update', ...) to grant the relevant categories.
  • Meta Pixel and Mixpanel SDKs are initialized but do not fire events until consent is granted.

Without a CMP installed

Events fire immediately when provider IDs are configured. The default GA4 Consent Mode v2 state is analytics_storage: granted.

Recommendation for EU traffic: install a CMP (Complianz is free and well-maintained) to comply with GDPR and ePrivacy requirements.

What data is sent

  • No personal data: only anonymous chat session IDs, product IDs, and monetary values.
  • Users identify themselves only if they voluntarily share personal information in the chat.
  • The 90-day visitor cookie (waa_visitor_id) is set only with analytics consent. Without consent, an ephemeral session-only ID is used that is never persisted.
add_filter( 'woo_ai_chatbot_consent_default', function( $state, $cmp ) {
    // Force denied by default regardless of CMP detection
    return 'denied';
}, 10, 2 );

Data flow


User action in chat widget
          |
          v
  trackEvent() central dispatcher
  (analytics/index.ts)
          |
    +-----+--------------------------------------------+
    |                                                  |
    v                                                  v
Internal: POST /woo-ai/v1/analytics/events     External providers (parallel):
          |                                           |-- window.gtag(...)        --> GA4
          v                                           |-- window.fbq(...)         --> Meta Pixel
  waa_events DB table                                +-- window.mixpanel.track() --> Mixpanel
          |
          v
  WP Admin Dashboard
  (Conversations + KPIs)

All three external providers fire in the same JavaScript tick — there is no serialization. The internal backend call is asynchronous and does not block the user experience.

Limitations and roadmap

  • Ad blockers (~25-30% of desktop users) block external SDKs. The internal Dashboard is always-on and unaffected. Use it as your ground truth for absolute numbers.
  • Server-side attribution (GA4 Measurement Protocol, Meta Conversions API) – planned for v0.40+. When available, it will recover approximately 30% of purchases that ad-blockers currently hide from external providers.
  • Cross-domain checkout – if your checkout domain differs from your shop domain, GA4 session continuity requires manual linker configuration. Contact support for assistance.
  • Revenue currency – requires plugin v0.38.17+. Earlier versions may report revenue in USD regardless of store currency.

Troubleshooting

SymptomLikely causeFix
No events appear in GA4 DebugView Measurement ID not saved, or Debug Mode toggle is off Verify the ID is in G-XXXXXXXXXX format. Enable the GA4 DebugView toggle in plugin settings. Install the Chrome extension “GA Debugger” for additional diagnostics.
Meta Pixel Helper shows 0 events Ad blocker active, or wrong Pixel ID format Disable ad blocker for your test session. Pixel IDs are 10-16 digits with no letters. Re-save settings after correcting.
Mixpanel Live View is empty Wrong Project Token, or CMP blocking consent Copy the token from Mixpanel → Settings → Project Settings. If a CMP is installed, accept cookies first — Mixpanel fires only after analytics consent is granted.
Revenue shows in wrong currency in GA4 Plugin version below 0.38.17 Update the plugin to the latest version.
Meta Pixel events fire twice Plugin version below 0.38.19 Update the plugin to the latest version.
No ecommerce events at all WooCommerce not active, or products not shown in chat Ecommerce events require WooCommerce to be active and a product card to appear in the chat response. Verify a product card is shown in chat, then check the provider debug tools.
Events fire before consent (GDPR concern) No CMP installed; events fire immediately by default Install a CMP compatible with the WordPress Consent API (e.g. Complianz). The plugin detects it automatically and switches to consent-gated mode.

Still stuck? Open WP Admin → WooAI Assistant → Analytics Settings and use the built-in connection test button, or check the browser console for [GA4Tracker], [MetaPixel], and [Mixpanel] log messages.

Settings page direct link: /wp-admin/admin.php?page=woo-ai-chatbot-analytics-settings

8. Chat Log Centralization (v0.38.22+)

Closed chat sessions are automatically pushed (hourly) from each client site to the central License Manager database on dev37. This allows the WooAI team to analyze conversations for AI quality improvement.

What gets pushed

  • Session metadata: start/end time, message counts, outcome, language
  • Full conversation messages (user + AI turns with timestamps)
  • Hashed visitor identifier (SHA-256 — never the raw cookie value)
  • AI provider, model used, and topic metadata

How it works

The plugin registers an hourly WP-Cron job (woo_ai_chatbot_push_chat_logs). When it fires, it fetches up to 50 expired sessions not yet pushed, builds a JSON payload, and POSTs to:

POST https://dev37.leowebmarketing.pro/wp-json/wooai-license/v1/chat-logs/upload

The endpoint validates the license key and domain activation before accepting data. Sessions are marked pushed_to_lm = 1 on success.

Privacy

The visitor_id cookie value is SHA-256 hashed before transmission — the raw value never leaves the client site. Right-to-be-forgotten requests: contact support to delete by hashed visitor ID.

Retention

  • Central LM database (dev37): 90 days
  • Local client site: sessions are retained per the existing session expiry setting

Viewing logs

Access the central log viewer at: WP Admin (dev37) → Licenses → Chat Logs