Internal / Proworkbench Analytics Port Map

ProWorkbench Analytics Port Map

This document maps the stronger SnippetSupply analytics system into the ProWorkbench ecosystem.

Goals

  • Run the new analytics stack in parallel with existing analytics_events
  • Track both proworkbench.com and pbdownloads.proworkbench.com as one funnel
  • Preserve cross-subdomain session continuity
  • Give the new admin workspace a real analytics home before retiring the legacy page

Source To Target Map

| SnippetSupply source | ProWorkbench target | Reuse | Notes |

| --- | --- | --- | --- |

| /var/www/snippetsupply.com/analytics.php | /var/www/proworkbench.com/app/analytics_port.php | Adapt | Core request/session/event collection logic ports cleanly with renamed helpers and ProWorkbench-specific event names. |

| /var/www/snippetsupply.com/schema.sql analytics tables | /var/www/proworkbench.com/db/schema.sql | Adapt | Port analytics_sessions, analytics_pageviews, analytics_site_events, analytics_rollup_daily, plus a ProWorkbench-specific analytics_download_events. |

| /var/www/snippetsupply.com/db/migrations/20260317_site_analytics.sql | /var/www/proworkbench.com/db/migrations/20260329_unified_site_analytics.sql | Adapt | Same first-party collection model, but scoped to both main site and pbdownloads hosts. |

| /var/www/snippetsupply.com/db/migrations/20260322_internal_analytics_upgrade.sql | /var/www/proworkbench.com/db/migrations/20260329_unified_site_analytics.sql | Partial | We are porting the useful session/pageview/site-event fields and rollup table now; notes/settings can wait for a later admin expansion. |

| /var/www/snippetsupply.com/admin/analytics.php | /var/www/proworkbench.com/app/analytics_port.php and /var/www/proworkbench.com/views/admin_workspace_analytics.php | Adapt | Query patterns and reporting shape are reusable, but the dashboard must reflect ProWorkbench funnel stages and hosts. |

SnippetSupply Concepts Reused Directly

  • First-party analytics cookie separate from PHP session
  • Shared cross-subdomain cookie domain
  • Session table with first-touch referrer and UTM capture
  • Pageview table separate from event table
  • Event payload JSON for flexible funnel metadata
  • Distinct host/path capture so reports can compare site sections cleanly
  • Bot filtering and external-referrer normalization
  • Daily trend and source/page query patterns

Pieces That Must Be Adapted

  • Event vocabulary:

- SnippetSupply focuses on marketplace/search/download behavior

- ProWorkbench needs discovery-to-purchase-to-delivery funnel events across two hosts

  • Product resolution:

- Main site uses products_cache

- pbdownloads uses pbdownloads_catalog_products and platform-driven pages

  • Purchase truth:

- Stripe purchase completion must come from server-side order/webhook/entitlement flow

- We should not trust only success-page frontend states

  • Dashboard structure:

- Needs unified funnel, host splits, OS/platform conversion, revenue, and delivery metrics

ProWorkbench Event Model

Main site events:

  • page_view
  • outbound_click
  • enterprise_click
  • blog_click
  • download_cta_click

pbdownloads events:

  • platform_selection_view
  • platform_selected
  • checkout_page_view
  • checkout_started
  • stripe_checkout_redirect
  • checkout_completed
  • purchase_paid
  • success_page_view
  • cancel_page_view
  • download_clicked
  • download_delivered

Rollout Plan

1. Add new analytics tables and helper layer in parallel with legacy analytics_events

2. Keep existing ProWorkbench analytics pages untouched

3. Record new events from both hosts using the shared analytics cookie

4. Surface the new dashboard inside /admin/workspace/analytics

5. Compare outputs before retiring the older analytics summary

Integration Points

  • Main site layout:

- server-side pageview capture

- frontend click event posting for outbound/blog/enterprise/download CTA interactions

  • Main site API:

- extend /api/analytics/event to feed both legacy and new analytics

  • pbdownloads render pipeline:

- server-side pageview capture

- server-side funnel event capture per rendered view

  • pbdownloads Stripe/order flow:

- checkout redirect, paid purchase, success, and delivery events must be emitted from backend code paths

Files Expected In This Port

  • /var/www/proworkbench.com/app/analytics_port.php
  • /var/www/proworkbench.com/db/migrations/20260329_unified_site_analytics.sql
  • /var/www/proworkbench.com/views/admin_workspace_analytics.php
  • /var/www/proworkbench.com/db/schema.sql
  • /var/www/proworkbench.com/app/bootstrap.php
  • /var/www/proworkbench.com/public/api/index.php
  • /var/www/proworkbench.com/views/layout.php
  • /var/www/pbdownloads/app/bootstrap.php
  • /var/www/pbdownloads/app/helpers.php
  • /var/www/pbdownloads/app/router.php
  • /var/www/pbdownloads/app/repository.php
  • /var/www/pbdownloads/views/success.php