' . esc_html__( 'Settings', 'ad-click-tracking-for-gravity-forms' ) . ''; array_unshift( $links, $settings ); $links['pb_act_upgrade'] = sprintf( '%2$s', esc_url( Constants::upgrade_url( 'plugins-row' ) ), esc_html__( 'Upgrade', 'ad-click-tracking-for-gravity-forms' ) ); return $links; } /** * Paints the Upgrade action link with the brand gradient. * * The gradient rules sit behind @supports so that a browser without * background-clip:text keeps the solid fallback colour rather than * rendering transparent text on no background. */ public function print_upgrade_link_style(): void { ?> %2$s', esc_url( Constants::upgrade_url( 'plugins-row-meta' ) ), esc_html__( 'Track every traffic source, not just ads', 'ad-click-tracking-for-gravity-forms' ) ); return $meta; } /** * Renders the settings page and handles its save. */ public function render_page(): void { if ( ! current_user_can( 'manage_options' ) ) { return; } $this->maybe_save(); $default_on = (int) get_option( Constants::DEFAULT_ENABLED_OPTION, 0 ); $attribution = 'last' === get_option( Constants::ATTRIBUTION_OPTION, 'first' ) ? 'last' : 'first'; ?>

get_plugin_data( 'name' ) ); ?>

render_teaser(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Assembled with escaping inside Upsell::card(). echo Upsell::card( 'settings-card' ); ?>

__( 'First click', 'ad-click-tracking-for-gravity-forms' ), 'text' => __( 'The first ad click wins. Once someone arrives from an ad, that source stays with them for the full 30 days, even if they later click a different ad. Answers "which ad introduced this lead to us?"', 'ad-click-tracking-for-gravity-forms' ), ), array( 'name' => __( 'Last click', 'ad-click-tracking-for-gravity-forms' ), 'text' => __( 'The most recent ad click wins. Every new ad click replaces the stored one. Answers "which ad finally brought them back to convert?"', 'ad-click-tracking-for-gravity-forms' ), ), ); ?>

' . esc_html__( 'First click', 'ad-click-tracking-for-gravity-forms' ) . '', esc_html__( 'Google', 'ad-click-tracking-for-gravity-forms' ), esc_html__( 'Microsoft', 'ad-click-tracking-for-gravity-forms' ), '' . esc_html__( 'Google Ads', 'ad-click-tracking-for-gravity-forms' ) . '' ); ?>

' . esc_html__( 'Referral Source Tracking', 'ad-click-tracking-for-gravity-forms' ) . '' ); ?>

ad_click_entry_count(); ?>

get_base_gfield_id() . $constants->get_gfield_id( 'source' ) ); $form_ids = array(); foreach ( \GFAPI::get_forms() as $form ) { $form_ids[] = (int) $form['id']; } $count = 0; if ( ! empty( $form_ids ) ) { $result = \GFAPI::count_entries( $form_ids, array( 'start_date' => gmdate( 'Y-m-d H:i:s', time() - 30 * DAY_IN_SECONDS ), 'field_filters' => array( 'mode' => 'all', array( 'key' => $source_field, 'operator' => 'isnot', 'value' => 'Unknown', ), array( 'key' => $source_field, 'operator' => 'isnot', 'value' => '', ), ), ) ); $count = is_wp_error( $result ) ? 0 : (int) $result; } set_transient( self::COUNT_TRANSIENT, $count, HOUR_IN_SECONDS ); return $count; } /** * Persists the settings form when submitted with a valid nonce. */ private function maybe_save(): void { if ( ! isset( $_POST['submit'] ) ) { return; } check_admin_referer( self::NONCE_ACTION ); update_option( Constants::DEFAULT_ENABLED_OPTION, isset( $_POST['pb_act_tracking_default'] ) ? 1 : 0 ); $attribution = 'first'; if ( isset( $_POST['pb_act_attribution'] ) && 'last' === sanitize_key( wp_unslash( $_POST['pb_act_attribution'] ) ) ) { $attribution = 'last'; } update_option( Constants::ATTRIBUTION_OPTION, $attribution ); add_settings_error( 'pb_act', 'pb_act_saved', esc_html__( 'Settings saved.', 'ad-click-tracking-for-gravity-forms' ), 'updated' ); } }