Skip to Content
SDKTesting Your Integration

Testing Your Integration

Before releasing, confirm the SDK actually works end-to-end.

Point the SDK at your test environment

For local testing, pass your local backend URL as the third bootstrap() argument instead of production (there’s no default, so you set it explicitly):

\Appneck\Sdk\Sdk::bootstrap( 'pk_test_...', 'sk_test_...', 'http://localhost:8080', // your local Appneck backend __FILE__ );

Step-by-step test

  1. Set up a local or staging WordPress site (a plain install is fine).
  2. Install and activate your plugin (SDK bootstrapped, keys + URL set).
  3. When the opt-in card appears, click Allow & Continue. (A pro build bootstrapped with 'is_premium' => true shows no card; skip this step.) Until you do, a free plugin sends nothing at all, so no Installation will appear.
  4. In your Appneck Org Panel → [Your Product] → Installations, within a short while you should see one new Installation with:
    • Status: Active
    • Your test site’s PHP / WordPress version
    • A recent heartbeat timestamp

Note: heartbeats and event flushes run on WordPress cron, which only fires when the site gets traffic. On a quiet local site, visit a few pages (or trigger cron manually) to nudge things along if data seems slow to appear.

Testing a custom event

  1. Trigger whatever action in your plugin calls $sdk->track(...).
  2. If you want it to appear immediately rather than waiting for the cron, call $sdk->flush() right after.
  3. Check Product → Analytics → Events — your event name should appear.

Testing the opt-out (free plugins)

  1. Open your plugin’s settings page and confirm the Share usage data and Receive update emails switches appear (from render_settings_section()).
  2. Turn Share usage data off.
  3. Trigger a track() call and flush(): nothing new should arrive in the Org Panel, and $sdk->may_contact_appneck() should now be false.

Testing the deactivation survey

  1. Deactivate your plugin from the Plugins screen.
  2. Confirm the survey prompt appears.
  3. Submit a response, then check your Product’s analytics in the Org Panel.

Testing uninstall

  1. Make sure you’ve created uninstall.php at your plugin root (see Heartbeats & Installations).
  2. Delete the plugin.
  3. Confirm your cleanup ran (and no PHP errors on the Plugins screen).

If nothing shows up

See Troubleshooting & FAQ — the usual causes are: consent not granted, wrong/missing base URL, or bootstrap() accidentally placed inside plugins_loaded.