'; echo ''; echo ' ' . wp_kses_post($label); echo ''; } function ridoway_pixel_settings_page() { if (!current_user_can('manage_options')) { return; } ?>
' . esc_html__('Enter your OpenAI Ads Pixel ID (required for tracking).', 'ridoway-pixel') . '
'; }, 'ridoway-pixel', 'ridoway_pixel_settings_section' ); add_settings_field( 'ridoway_pixel_capi_key', esc_html__('Conversions API Key', 'ridoway-pixel'), function () { $value = get_option('ridoway_pixel_capi_key', ''); echo ''; echo '' . esc_html__('Enter your Conversions API key from Ads Manager (enables server-side event sending).', 'ridoway-pixel') . '
'; }, 'ridoway-pixel', 'ridoway_pixel_settings_section' ); add_settings_field( 'ridoway_pixel_async_capi', esc_html__('Async Conversions API', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field( 'async_capi', esc_html__('Send server events through the background queue (recommended — never slows the visitor)', 'ridoway-pixel'), '1' ); }, 'ridoway-pixel', 'ridoway_pixel_settings_section' ); add_settings_field( 'ridoway_pixel_validate_only', esc_html__('Validate Only', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field( 'validate_only', esc_html__('Validate requests without recording events (for testing your setup)', 'ridoway-pixel') ); }, 'ridoway-pixel', 'ridoway_pixel_settings_section' ); add_settings_field( 'ridoway_pixel_debug_mode', esc_html__('Debug Mode', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field( 'debug_mode', esc_html__('Enable debug mode (logs SDK activity to browser console and sends CAPI requests inline with logging)', 'ridoway-pixel') ); }, 'ridoway-pixel', 'ridoway_pixel_settings_section' ); add_settings_section( 'ridoway_pixel_consent_section', esc_html__('Consent', 'ridoway-pixel'), function () { echo '' . esc_html__('Set consent false before the pixel loads so the SDK waits for the visitor\'s choice. Consent managers can hook the ridoway_pixel_consent filter server-side or call window.ridowayPixelConsent.grant() / .deny() in the browser.', 'ridoway-pixel') . '
'; }, 'ridoway-pixel' ); add_settings_field( 'ridoway_pixel_respect_consent', esc_html__('Defer Until Consent', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field( 'respect_consent', esc_html__('Do not fire events until consent is given (works with your consent manager)', 'ridoway-pixel') ); }, 'ridoway-pixel', 'ridoway_pixel_consent_section' ); add_settings_section( 'ridoway_pixel_events_section', esc_html__('Events', 'ridoway-pixel'), function () { echo '' . esc_html__('Choose which OpenAI events to track. Everything is on by default.', 'ridoway-pixel') . '
'; }, 'ridoway-pixel' ); add_settings_field( 'ridoway_pixel_track_page_viewed', esc_html__('Page View', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field('track_page_viewed', esc_html__('Send page_viewed on every page', 'ridoway-pixel'), '1'); }, 'ridoway-pixel', 'ridoway_pixel_events_section' ); add_settings_field( 'ridoway_pixel_track_contents_viewed', esc_html__('Product View', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field('track_contents_viewed', esc_html__('Send contents_viewed on product pages', 'ridoway-pixel'), '1'); }, 'ridoway-pixel', 'ridoway_pixel_events_section' ); add_settings_field( 'ridoway_pixel_track_items_added', esc_html__('Add to Cart', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field('track_items_added', esc_html__('Send items_added when a product is added to the cart', 'ridoway-pixel'), '1'); }, 'ridoway-pixel', 'ridoway_pixel_events_section' ); add_settings_field( 'ridoway_pixel_track_checkout_started', esc_html__('Checkout Started', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field('track_checkout_started', esc_html__('Send checkout_started on the checkout page (once per cart)', 'ridoway-pixel'), '1'); }, 'ridoway-pixel', 'ridoway_pixel_events_section' ); add_settings_field( 'ridoway_pixel_track_order_created', esc_html__('Order Created', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field('track_order_created', esc_html__('Send order_created after a successful order (no duplicates, tracked statuses only)', 'ridoway-pixel'), '1'); }, 'ridoway-pixel', 'ridoway_pixel_events_section' ); add_settings_field( 'ridoway_pixel_track_lead_created', esc_html__('Lead Created', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field('track_lead_created', esc_html__('Send lead_created when a contact form is submitted', 'ridoway-pixel'), '1'); }, 'ridoway-pixel', 'ridoway_pixel_events_section' ); add_settings_section( 'ridoway_pixel_woo_section', esc_html__('WooCommerce', 'ridoway-pixel'), function () { echo '' . esc_html__('WooCommerce event tracking.', 'ridoway-pixel') . '
'; }, 'ridoway-pixel' ); add_settings_field( 'ridoway_pixel_woocommerce_tracking', esc_html__('WooCommerce Tracking', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field( 'woocommerce_tracking', esc_html__('Enable WooCommerce event tracking (items_added, checkout_started, order_created)', 'ridoway-pixel') ); }, 'ridoway-pixel', 'ridoway_pixel_woo_section' ); add_settings_field( 'ridoway_pixel_order_statuses', esc_html__('Report Orders With These Statuses', 'ridoway-pixel'), function () { $statuses = array( 'wc-pending' => esc_html__('Pending payment', 'ridoway-pixel'), 'wc-processing' => esc_html__('Processing', 'ridoway-pixel'), 'wc-on-hold' => esc_html__('On hold', 'ridoway-pixel'), 'wc-completed' => esc_html__('Completed', 'ridoway-pixel'), 'wc-cancelled' => esc_html__('Cancelled', 'ridoway-pixel'), 'wc-refunded' => esc_html__('Refunded', 'ridoway-pixel'), 'wc-failed' => esc_html__('Failed', 'ridoway-pixel'), ); $selected = get_option('ridoway_pixel_order_statuses', array('wc-processing', 'wc-completed', 'wc-on-hold')); if (!is_array($selected)) { $selected = array(); } foreach ($statuses as $value => $label) { echo ''; } echo '' . esc_html__('Only these order statuses count as conversions.', 'ridoway-pixel') . '
'; }, 'ridoway-pixel', 'ridoway_pixel_woo_section' ); add_settings_section( 'ridoway_pixel_lead_section', esc_html__('Lead Forms', 'ridoway-pixel'), function () { echo '' . esc_html__('Lead form tracking.', 'ridoway-pixel') . '
'; }, 'ridoway-pixel' ); add_settings_field( 'ridoway_pixel_lead_form_tracking', esc_html__('Lead Form Tracking', 'ridoway-pixel'), function () { ridoway_pixel_checkbox_field( 'lead_form_tracking', esc_html__('Enable lead form tracking (Contact Form 7, WPForms)', 'ridoway-pixel') ); }, 'ridoway-pixel', 'ridoway_pixel_lead_section' ); });