tracker = Plugin_Usage_Tracker::get_instance(THINKRANK_PLUGIN_FILE, [ 'opt_in' => true, 'goodbye_form' => true, 'item_id' => $item_id, ]); $this->tracker->set_notice_options([ 'notice_title' => __('Want to help make ThinkRank even better?', 'thinkrank'), 'notice' => __('Allow us to collect non-sensitive diagnostic data and usage information.', 'thinkrank'), 'extra_notice' => __('We collect non-sensitive diagnostic data and plugin usage information — your site URL, WordPress & PHP version, active plugins & theme, and admin email. This lets us keep ThinkRank compatible with the most popular plugins and themes. No spam, we promise.', 'thinkrank'), ]); $this->tracker->init(); } /** * Record explicit user consent for usage tracking. * * Called by flows outside the opt-in notice (e.g. the Setup Wizard * "Get Started" action). Builds the tracker if it has not been wired * yet so consent works regardless of hook timing. * * @return void */ public function grant_consent(): void { if (null === $this->tracker) { $this->start_tracking(); } $this->tracker->opt_in(); } /** * Expose the tracker instance (mainly for tests / diagnostics). * * @return Plugin_Usage_Tracker|null */ public function get_tracker(): ?Plugin_Usage_Tracker { return $this->tracker; } }