| 开发者 | infinitnet |
|---|---|
| 更新时间 | 2026年11月26日 20:50 |
| PHP版本: | 7.2 及以上 |
| WordPress版本: | 7.2 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
/wp-content/plugins/analytics-integration-for-posthog-wp-wc directory, or install the plugin through the WordPress plugins screenLog in to your PostHog account, navigate to Project Settings, and copy the Project API Key (starts with 'phc_').
Yes, the plugin works with standard WordPress sites for basic analytics. WooCommerce-specific tracking is only activated when WooCommerce is installed and active.
Yes, you can use a custom API host URL for reverse proxy PostHog instances.
The plugin ships PostHog's current HTML loader snippet, which loads the latest posthog-js v1 from PostHog's assets CDN (or from your custom instance or reverse proxy). Nothing is bundled.
Set Persistence to localStorage to avoid PostHog cookies, or use Cookieless Mode always to store nothing in the browser. Cookieless mode must also be enabled in your PostHog project settings.
Enable Require Consent (or set Cookieless Mode to on_reject) and have your consent tool call posthog.opt_in_capturing() when the visitor accepts and posthog.opt_out_capturing() when they decline. Do not combine Require Consent with Cookieless Mode on_reject.
Yes. The infnet_posthog_distinct_id filter receives the WordPress user ID and the user object. Use a site-specific value when several sites share one PostHog project.
Names in brackets are used with the PostHog ecommerce spec setting.
view_product (Product Viewed): a product page is shownview_product_list (Product List Viewed): a shop, category or tag archive is shown. Lists the products on that pageadd_to_cart (Product Added): once per add, with the added quantity. Covers AJAX buttons, product forms, add to cart links and the Product Collection, Add to Cart and Mini-Cart blocksremove_from_cart (Product Removed): once per removed cart linecart_updated: once per cart change, with the new cart totals and cart_action (add, remove, quantity or mixed). A quantity change also has product_id, quantity and previous_quantitycart_view (Cart Viewed): once per view of the cart pagebegin_checkout (Checkout Started): once per cart when the checkout page is shown. Reloading the page does not repeat itorder_completed (Order Completed): once per order, when the shopper sees the order received pagecheckout_progress, checkout_field_interaction, payment_method_selected: classic checkout form onlyOrders placed through the classic checkout, the Checkout block, express payment buttons or the order pay page, at the moment the shopper reaches the order received page. Each order is sent once, also when that page is reloaded or opened again.
Not sent: failed, cancelled and refunded orders (a failed payment is sent when the retry succeeds), orders created in wp-admin, subscription renewals, order received links older than 7 days, and orders whose shopper never returns to the order received page (for example when the tab is closed on the payment provider's site).
The infnet_posthog_track_order_completed filter (arguments: the decision, the order) changes which orders are sent. infnet_posthog_purchase_max_age changes the 7 days.
Cart changes happen in background requests that do not load a page. After such a request the plugin sets a first-party cookie named infnet_posthog_ev_ plus a random token. The page then fetches the cart events once and sends them to PostHog. The cookie holds no personal data, is removed as soon as the events are fetched (normally within a second) and expires after 30 minutes. It is only set when a PostHog Project ID is configured and the cart changed. The events are only sent if the visitor has not opted out of PostHog.
This plugin integrates with PostHog, which has GDPR compliance features. The plugin itself is designed to work with PostHog's privacy controls. However, you are responsible for ensuring your specific implementation meets GDPR requirements, including proper consent management.