'defer', 'in_footer' => true, ) ); $config = array( 'days' => (int) Settings::get( 'cookie_days' ), 'consent' => (string) Settings::get( 'consent_mode' ), 'params' => array_values( array_diff( Attribution::keys(), array( 'ref', 'lp', 'ts' ) ) ), 'endpoint' => esc_url_raw( rest_url( Rest_Api::NAMESPACE_V1 . '/submit' ) ), 'forms' => self::form_selector(), 'names' => Form_Selection::names(), 'auto' => (bool) Settings::get( 'found_forms' ), 'declined' => implode( ', ', array_filter( Form_Selection::get()['declined'], array( Form_Discovery::class, 'is_valid' ) ) ), 'orders' => Orders::enabled(), 'clicks' => (bool) Settings::get( 'track_clicks' ), 'visits' => (bool) Settings::get( 'count_visits' ), 'live' => Live::enabled(), 'stats' => (bool) Settings::get( 'form_stats' ), 'dataLayer' => (bool) Settings::get( 'data_layer' ), ); wp_add_inline_script( 'dealroot-tracker', 'window.dealrootTracker = ' . wp_json_encode( $config ) . ';', 'before' ); } /** * Forms captured through the REST endpoint. * * @return string */ public static function form_selector() { $selector = '[data-dealroot]'; foreach ( array( Form_Selection::selectors(), trim( (string) Settings::get( 'capture_selector' ) ) ) as $extra ) { if ( '' !== $extra ) { $selector .= ', ' . $extra; } } /** * Filters the CSS selector of forms captured without a dedicated integration. * * @param string $selector CSS selector. */ return (string) apply_filters( 'dealroot_form_selector', $selector ); } }