Linux 软件免费装

Analytics Integration for PostHog, WP, & WC

开发者 infinitnet
更新时间 2026年11月26日 20:50
PHP版本: 7.2 及以上
WordPress版本: 7.2
版权: GPLv2 or later
版权网址: 版权信息

标签

tracking woocommerce ecommerce analytics posthog

下载

1.5.4 1.5.1 1.5.2 1.5.3 1.5.5 1.6.0 1.6.1

详情介绍:

This (unofficial) PostHog plugin offers visitor and user tracking for WordPress and WooCommerce websites, leveraging PostHog’s powerful analytics platform. Features Why Use PostHog? PostHog is an all-in-one platform that helps you build better products. It includes all the tools you need to deploy changes, observe their effect, gather feedback, and iterate from there, and it’s completely free to get started. Some of the features PostHog offers include... You can create a free account with PostHog at posthog.com WooCommerce Features With WooCommerce enabled, the plugin automatically tracks: Each event is sent once per action, on classic and block themes. See the FAQ for the event list. Gutenberg Experiment Support Create and manage PostHog experiments directly in the Gutenberg editor. Test different content variations using PostHog feature flags without any coding. Link Click Tracking Monitor link clicks with customizable link prefixes, supporting both direct links and encoded/obfuscated links.

安装:

  1. Upload the plugin files to the /wp-content/plugins/analytics-integration-for-posthog-wp-wc directory, or install the plugin through the WordPress plugins screen
  2. Activate the plugin through the 'Plugins' screen in WordPress
  3. Navigate to Settings > PostHog Integration to configure the plugin
  4. Enter your PostHog Project ID (starts with 'phc_')
  5. Choose your PostHog instance (US, EU, or custom)
  6. Configure additional options as needed

升级注意事项:

1.6.1 WooCommerce events are now complete on block themes and the Cart and Checkout blocks, and each event is sent once. cart_updated is no longer sent on every page load, view_product_list lists the products on the page, order_completed is sent once per order. 1.4.8 Important fixes for WooCommerce compatibility and checkout tracking. Recommended update for all users. 1.4.6 Added link click tracking and improved experiment functionality. 1.4.0 Major update with Gutenberg experiment support and enhanced WooCommerce integration.

常见问题:

Where do I find my PostHog Project ID?

Log in to your PostHog account, navigate to Project Settings, and copy the Project API Key (starts with 'phc_').

Does this plugin work without WooCommerce?

Yes, the plugin works with standard WordPress sites for basic analytics. WooCommerce-specific tracking is only activated when WooCommerce is installed and active.

Can I use this with other PostHog instances besides the official ones?

Yes, you can use a custom API host URL for reverse proxy PostHog instances.

How do I set up an experiment?

  1. Enable Gutenberg experiments in the plugin settings
  2. Edit a post or page with the Gutenberg editor
  3. Select any block and use the PostHog Experiment panel in the block settings sidebar
  4. Enter your feature flag name and variant
  5. Save your post/page

Which PostHog snippet does the plugin use?

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.

How do I use PostHog without cookies?

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.

How do I connect a consent banner?

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.

Can I change the distinct ID used for logged-in users?

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.

Which WooCommerce events are sent, and when?

Names in brackets are used with the PostHog ecommerce spec setting.

  • view_product (Product Viewed): a product page is shown
  • view_product_list (Product List Viewed): a shop, category or tag archive is shown. Lists the products on that page
  • add_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 blocks
  • remove_from_cart (Product Removed): once per removed cart line
  • cart_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_quantity
  • cart_view (Cart Viewed): once per view of the cart page
  • begin_checkout (Checkout Started): once per cart when the checkout page is shown. Reloading the page does not repeat it
  • order_completed (Order Completed): once per order, when the shopper sees the order received page
  • checkout_progress, checkout_field_interaction, payment_method_selected: classic checkout form only

Which orders send order_completed?

Orders 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.

What is the infnet_posthog_ev_ cookie?

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.

Is this plugin GDPR compliant?

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.

更新日志:

1.6.1 1.6.0 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.0 1.3.0 1.2.0 1.1.0 1.0.0