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
- Set up a local or staging WordPress site (a plain install is fine).
- Install and activate your plugin (SDK bootstrapped, keys + URL set).
- When the opt-in card appears, click Allow & Continue. (A pro build
bootstrapped with
'is_premium' => trueshows no card; skip this step.) Until you do, a free plugin sends nothing at all, so no Installation will appear. - 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
- Trigger whatever action in your plugin calls
$sdk->track(...). - If you want it to appear immediately rather than waiting for the cron,
call
$sdk->flush()right after. - Check Product → Analytics → Events — your event name should appear.
Testing the opt-out (free plugins)
- Open your plugin’s settings page and confirm the Share usage data and
Receive update emails switches appear (from
render_settings_section()). - Turn Share usage data off.
- Trigger a
track()call andflush(): nothing new should arrive in the Org Panel, and$sdk->may_contact_appneck()should now befalse.
Testing the deactivation survey
- Deactivate your plugin from the Plugins screen.
- Confirm the survey prompt appears.
- Submit a response, then check your Product’s analytics in the Org Panel.
Testing uninstall
- Make sure you’ve created
uninstall.phpat your plugin root (see Heartbeats & Installations). - Delete the plugin.
- 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.