Alpha Insights uses a modular integrations system so that third-party services (e.g. Facebook Ads, Google Ads, ShipStation, Webhooks) can be presented in a single settings UI and each integration can provide its own settings form and save logic. You can add custom integrations that appear alongside the built-in ones.
The system has two layers:
wpd_ai_register_integration_metadata so that even integrations without a loaded class (e.g. Pro integrations on the free version) can be listed.WPDAI_Integration_Base that provides settings UI and save handling. Registered via wpd_ai_register_integrations. When an instance is present, the user can open that integration and see render_settings() output; when they save the main settings form, save_settings() is called.The Integrations Manager (WPDAI_Integrations_Manager) is a singleton that:
wpd_ai_register_integration_metadata (init priority 4) so plugins/themes can register metadatawpd_ai_register_integrations (init priority 5) so integration classes can register themselvesincludes/integrations/register/ (free) and includes/integrations/register/pro/ (Pro), then merges metadata with instances for display?integrations=slug), the integration's settings form (from the instance)The integrations page is under Alpha Insights → Settings → Integrations. The URL is the settings page with optional integrations query parameter:
?integrations=slug or to a custom url if set in metadata.render_settings() is output inside the main settings form; if the slug has metadata but no instance (e.g. Pro on free), an upsell message is shown.Categories are derived from metadata (category). The UI includes search and category tabs; each card's data-category and data-search drive filtering.
The plugin registers metadata (and, when the code is loaded, instances) for:
urlPro integrations in the free version appear as cards with a Pro badge and show an upsell when clicked; no class is loaded so there is no instance.
includes/integrations/WPDAI_Integrations_Manager.phpincludes/integrations/WPDAI_Integration_Base.phpincludes/integrations/register/*.php (free), includes/integrations/register/pro/*.php (Pro)WPDAI_Integrations_Manager::output_integrations_page(); the menu entry is wired in admin (e.g. subpage integrations under settings).WPDAI_Integration_Base methods and contractwpd_ai_register_integration_metadata, wpd_ai_register_integrations, and wpd_ai_save_settings