<?php

defined('ABSPATH') or exit('Please don&rsquo;t call the plugin directly. Thanks :)');

function seopress_google_analytics_enable_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_enable']); ?>

<label for="seopress_google_analytics_enable">
    <input id="seopress_google_analytics_enable"
        name="seopress_google_analytics_option_name[seopress_google_analytics_enable]" type="checkbox" <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>

    <?php esc_attr_e('Enable Google Analytics tracking (Global Site Tag: gtag.js)', 'wp-seopress'); ?>
</label>

<?php if (isset($options['seopress_google_analytics_enable'])) {
        esc_attr($options['seopress_google_analytics_enable']);
    }
}

function seopress_google_analytics_ga4_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_ga4']) ? $options['seopress_google_analytics_ga4'] : null;

    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_ga4]" placeholder="' . esc_html__('Enter your measurement ID (G-XXXXXXXXXX)', 'wp-seopress') . '" aria-label="' . esc_attr__('Enter your measurement ID', 'wp-seopress') . '" value="%s"/>',
esc_html($check)
); ?>

<p class="seopress-help description">
    <span class="dashicons dashicons-external"></span>
    <a href="https://support.google.com/analytics/answer/9539598?hl=en&ref_topic=9303319" target="_blank">
        <?php esc_attr_e('Find your measurement ID', 'wp-seopress'); ?>
    </a>
</p>
<?php
}

function seopress_google_analytics_hook_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $selected = isset($options['seopress_google_analytics_hook']) ? $options['seopress_google_analytics_hook'] : null; ?>

<select id="seopress_google_analytics_hook"
    name="seopress_google_analytics_option_name[seopress_google_analytics_hook]">
    <option <?php if ('wp_body_open' == $selected) { ?>
        selected="selected"
        <?php } ?>
        value="wp_body_open"><?php esc_attr_e('After the opening body tag (recommended)', 'wp-seopress'); ?>
    </option>
    <option <?php if ('wp_footer' == $selected) { ?>
        selected="selected"
        <?php } ?>
        value="wp_footer"><?php esc_attr_e('Footer', 'wp-seopress'); ?>
    </option>
    <option <?php if ('wp_head' == $selected) { ?>
        selected="selected"
        <?php } ?>
        value="wp_head"><?php esc_attr_e('Head (not recommended)', 'wp-seopress'); ?>
    </option>
</select>

<p class="description">
    <?php echo wp_kses_post(__('Your theme must be compatible with <code>wp_body_open</code> hook introduced in WordPress 5.2 if "opening body tag" option selected.')); ?>
</p>

<?php if (isset($options['seopress_google_analytics_hook'])) {
        esc_attr($options['seopress_google_analytics_hook']);
    }
}

function seopress_google_analytics_disable_callback() {
    $docs = seopress_get_docs_links();

    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_disable']); ?>

<label for="seopress_google_analytics_disable">
    <input id="seopress_google_analytics_disable"
        name="seopress_google_analytics_option_name[seopress_google_analytics_disable]" type="checkbox" <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Request user\'s consent for analytics tracking (required by GDPR)', 'wp-seopress'); ?>
</label>

<div class="seopress-notice">
    <p><?php echo wp_kses_post(__('The user must click the <strong>Accept button</strong> to allow tracking.', 'wp-seopress')); ?>
    </p>
</div>

<p class="description">
    <?php esc_attr_e('User roles excluded from tracking will not see the consent message.', 'wp-seopress'); ?>
</p>
<p class="description">
    <?php esc_attr_e('If you use a caching plugin, you have to exclude this JS file in your settings:', 'wp-seopress'); ?>
</p>
<p class="description">
    <?php echo wp_kses_post(__('<code>/wp-content/plugins/wp-seopress/assets/js/seopress-cookies-ajax.js</code> and this cookie <code>seopress-user-consent-accept</code>', 'wp-seopress')); ?>
    <?php echo seopress_tooltip_link(esc_url($docs['analytics']['custom_tracking']), esc_attr__('Hook to add custom tracking code with user consent - new window', 'wp-seopress')); ?>
</p>

<?php if (isset($options['seopress_google_analytics_disable'])) {
        esc_attr($options['seopress_google_analytics_disable']);
    }
}

function seopress_google_analytics_half_disable_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_half_disable']); ?>

<label for="seopress_google_analytics_half_disable">
    <input id="seopress_google_analytics_half_disable"
        name="seopress_google_analytics_option_name[seopress_google_analytics_half_disable]" type="checkbox" <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Display and automatically accept the user‘s consent on page load (not fully GDPR)', 'wp-seopress'); ?>
</label>

<p class="description">
    <?php esc_attr_e('The previous option must be checked to use this.', 'wp-seopress'); ?>
</p>

<?php if (isset($options['seopress_google_analytics_half_disable'])) {
        esc_attr($options['seopress_google_analytics_half_disable']);
    }
}

function seopress_google_analytics_opt_out_edit_choice_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_opt_out_edit_choice']); ?>

<label for="seopress_google_analytics_opt_out_edit_choice">
    <input id="seopress_google_analytics_opt_out_edit_choice"
        name="seopress_google_analytics_option_name[seopress_google_analytics_opt_out_edit_choice]" type="checkbox"
        <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Allow user to change its choice about cookies', 'wp-seopress'); ?>
</label>

<?php if (isset($options['seopress_google_analytics_opt_out_edit_choice'])) {
        esc_attr($options['seopress_google_analytics_opt_out_edit_choice']);
    }
}

function seopress_google_analytics_opt_out_msg_callback() {
    $docs    = seopress_get_docs_links();
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_opt_out_msg']) ? $options['seopress_google_analytics_opt_out_msg'] : null;

    printf(
'<textarea id="seopress_google_analytics_opt_out_msg" name="seopress_google_analytics_option_name[seopress_google_analytics_opt_out_msg]" rows="4" placeholder="' . esc_html__('Enter your message (HTML allowed)', 'wp-seopress') . '" aria-label="' . esc_attr__('This message will only appear if request user\'s consent is enabled.', 'wp-seopress') . '">%s</textarea>',
esc_html($check)); ?>

<?php echo seopress_tooltip_link($docs['analytics']['consent_msg'], esc_attr__('Hook to filter user consent message - new window', 'wp-seopress')); ?>

<p class="description">
    <?php esc_attr_e('HTML tags allowed: strong, em, br, a href / target', 'wp-seopress'); ?>
</p>
<p class="description">
    <?php esc_attr_e('Shortcode allowed to get the privacy page set in WordPress settings: [seopress_privacy_page]', 'wp-seopress'); ?>
</p>

<?php
}

function seopress_google_analytics_opt_out_msg_ok_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_opt_out_msg_ok']) ? $options['seopress_google_analytics_opt_out_msg_ok'] : null;

    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_opt_out_msg_ok]" placeholder="' . esc_html__('Accept', 'wp-seopress') . '" aria-label="' . esc_attr__('Change the button value', 'wp-seopress') . '" value="%s"/>',
esc_html($check)
);
}

function seopress_google_analytics_opt_out_msg_close_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_opt_out_msg_close']) ? $options['seopress_google_analytics_opt_out_msg_close'] : null;

    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_opt_out_msg_close]" placeholder="' . esc_html__('default: X', 'wp-seopress') . '" aria-label="' . esc_attr__('Change the close button value', 'wp-seopress') . '" value="%s"/>',
esc_html($check)
);
}

function seopress_google_analytics_opt_out_msg_edit_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_opt_out_msg_edit']) ? $options['seopress_google_analytics_opt_out_msg_edit'] : null;

    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_opt_out_msg_edit]" placeholder="' . esc_html__('default: Manage cookies', 'wp-seopress') . '" aria-label="' . esc_attr__('Change the edit button value', 'wp-seopress') . '" value="%s"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_exp_date_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_cb_exp_date']); ?>

<input type="number" min="1" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_exp_date]" <?php if ('1' == $check) { ?>
value="<?php echo esc_attr($options['seopress_google_analytics_cb_exp_date']); ?>"
<?php } ?>
value="30"/>

<?php if (isset($options['seopress_google_analytics_cb_exp_date'])) {
        esc_html($options['seopress_google_analytics_cb_exp_date']);
    } ?>

<p class="description">
    <?php esc_attr_e('Default: 30 days before the cookie expiration.', 'wp-seopress'); ?>
</p>

<?php
}

function seopress_google_analytics_cb_pos_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $selected = isset($options['seopress_google_analytics_cb_pos']) ? $options['seopress_google_analytics_cb_pos'] : null; ?>

<select id="seopress_google_analytics_cb_pos"
    name="seopress_google_analytics_option_name[seopress_google_analytics_cb_pos]">
    <option <?php if ('bottom' == $selected) { ?>
        selected="selected"
        <?php } ?>
        value="bottom"><?php esc_attr_e('Bottom (default)', 'wp-seopress'); ?>
    </option>
    <option <?php if ('center' == $selected) { ?>
        selected="selected"
        <?php } ?>
        value="center"><?php esc_attr_e('Middle', 'wp-seopress'); ?>
    </option>
    <option <?php if ('top' == $selected) { ?>
        selected="selected"
        <?php } ?>
        value="top"><?php esc_attr_e('Top', 'wp-seopress'); ?>
    </option>
</select>

<?php if (isset($options['seopress_google_analytics_cb_pos'])) {
        esc_attr($options['seopress_google_analytics_cb_pos']);
    }
}

function seopress_google_analytics_cb_txt_align_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $selected = isset($options['seopress_google_analytics_cb_txt_align']) ? $options['seopress_google_analytics_cb_txt_align'] : 'center'; ?>

<select id="seopress_google_analytics_cb_txt_align"
    name="seopress_google_analytics_option_name[seopress_google_analytics_cb_txt_align]">
    <option <?php if ('left' == $selected) { ?>
        selected="selected"
        <?php } ?>
        value="left"><?php esc_attr_e('Left', 'wp-seopress'); ?>
    </option>
    <option <?php if ('center' == $selected) { ?>
        selected="selected"
        <?php } ?>
        value="center"><?php esc_attr_e('Center (default)', 'wp-seopress'); ?>
    </option>
    <option <?php if ('right' == $selected) { ?>
        selected="selected"
        <?php } ?>
        value="right"><?php esc_attr_e('Right', 'wp-seopress'); ?>
    </option>
</select>

<?php
    if (isset($options['seopress_google_analytics_cb_txt_align'])) {
        esc_attr($options['seopress_google_analytics_cb_txt_align']);
    }
}

function seopress_google_analytics_cb_width_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_width']) ? $options['seopress_google_analytics_cb_width'] : null;

    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_width]" aria-label="' . esc_attr__('Change the cookie bar width', 'wp-seopress') . '" value="%s"/>',
esc_html($check)
); ?>
<p class="description">
    <?php esc_attr_e('Default unit is Pixels. Add % just after your custom value to use percentages (e.g. 80%).', 'wp-seopress'); ?>
</p>

<?php
}

function seopress_google_analytics_cb_backdrop_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_cb_backdrop']); ?>

<hr>

<h2>
    <?php esc_attr_e('Backdrop', 'wp-seopress'); ?>
</h2>

<p>
    <?php echo wp_kses_post(__('Customize the cookie bar <strong>backdrop</strong>.', 'wp-seopress')); ?>
</p>

<label for="seopress_google_analytics_cb_backdrop">
    <input id="seopress_google_analytics_cb_backdrop"
        name="seopress_google_analytics_option_name[seopress_google_analytics_cb_backdrop]" type="checkbox" <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Display a backdrop with the cookie bar', 'wp-seopress'); ?>
</label>

<?php if (isset($options['seopress_google_analytics_cb_backdrop'])) {
        esc_attr($options['seopress_google_analytics_cb_backdrop']);
    }
}

function seopress_google_analytics_cb_backdrop_bg_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_backdrop_bg']) ? $options['seopress_google_analytics_cb_backdrop_bg'] : null; ?>

<p class="description">
    <?php esc_attr_e('Background color: ', 'wp-seopress'); ?>
</p>

<?php printf(
'<input type="text" data-default-color="rgba(255,255,255,0.8)" data-alpha="true" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_backdrop_bg]" aria-label="' . esc_attr__('Change the background color of the backdrop', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_bg_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_bg']) ? $options['seopress_google_analytics_cb_bg'] : null; ?>
<hr>

<h2><?php esc_attr_e('Main settings', 'wp-seopress'); ?>
</h2>

<p>
    <?php echo wp_kses_post(__('Customize the general settings of the <strong>cookie bar</strong>.', 'wp-seopress')); ?>
</p>

<p class="description">
    <?php esc_attr_e('Background color: ', 'wp-seopress'); ?>
</p>

<?php
    printf(
'<input type="text" data-alpha="true" data-default-color="#F1F1F1" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_bg]" aria-label="' . esc_attr__('Change the color of the cookie bar background', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_txt_col_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_txt_col']) ? $options['seopress_google_analytics_cb_txt_col'] : null; ?>

<p class="description">
    <?php esc_attr_e('Text color: ', 'wp-seopress'); ?>
</p>

<?php
    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_txt_col]" aria-label="' . esc_attr__('Change the color of the cookie bar text', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_lk_col_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_lk_col']) ? $options['seopress_google_analytics_cb_lk_col'] : null; ?>

<p class="description">
    <?php esc_attr_e('Link color: ', 'wp-seopress'); ?>
</p>

<?php
    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_lk_col]" aria-label="' . esc_attr__('Change the color of the cookie bar link', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_btn_bg_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_btn_bg']) ? $options['seopress_google_analytics_cb_btn_bg'] : null; ?>

<hr>

<h2>
    <?php esc_attr_e('Primary button', 'wp-seopress'); ?>
</h2>

<p>
    <?php echo wp_kses_post(__('Customize the <strong>Accept button</strong>.', 'wp-seopress')); ?>
</p>

<p class="description">
    <?php esc_attr_e('Background color: ', 'wp-seopress'); ?>
</p>

<?php printf(
'<input type="text" data-alpha="true" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_btn_bg]" aria-label="' . esc_attr__('Change the color of the cookie bar button background', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_btn_bg_hov_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_btn_bg_hov']) ? $options['seopress_google_analytics_cb_btn_bg_hov'] : null; ?>

<p class="description">
    <?php esc_attr_e('Background color on hover: ', 'wp-seopress'); ?>
</p>

<?php
    printf(
'<input type="text" data-alpha="true" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_btn_bg_hov]" aria-label="' . esc_attr__('Change the color of the cookie bar button hover background', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_btn_col_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_btn_col']) ? $options['seopress_google_analytics_cb_btn_col'] : null; ?>

<p class="description">
    <?php esc_attr_e('Text color: ', 'wp-seopress'); ?>
</p>

<?php
    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_btn_col]" aria-label="' . esc_attr__('Change the color of the cookie bar button', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_btn_col_hov_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_btn_col_hov']) ? $options['seopress_google_analytics_cb_btn_col_hov'] : null; ?>

<p class="description">
    <?php esc_attr_e('Text color on hover: ', 'wp-seopress'); ?>
</p>

<?php
    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_btn_col_hov]" aria-label="' . esc_attr__('Change the color of the cookie bar button hover', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_btn_sec_bg_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_btn_sec_bg']) ? $options['seopress_google_analytics_cb_btn_sec_bg'] : null; ?>

<hr>

<h2>
    <?php esc_attr_e('Secondary button', 'wp-seopress'); ?>
</h2>

<p>
    <?php echo wp_kses_post(__('Customize the <strong>Close button</strong>.', 'wp-seopress')); ?>
</p>

<p class="description">
    <?php esc_attr_e('Background color: ', 'wp-seopress'); ?>
</p>

<?php
    printf(
'<input type="text" data-alpha="true" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_btn_sec_bg]" aria-label="' . esc_attr__('Change the color of the cookie bar secondary button background', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_btn_sec_bg_hov_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_btn_sec_bg_hov']) ? $options['seopress_google_analytics_cb_btn_sec_bg_hov'] : null; ?>

<p class="description">
    <?php esc_attr_e('Background color on hover: ', 'wp-seopress'); ?>
</p>

<?php
    printf(
'<input type="text" data-alpha="true" data-default-color="#222222" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_btn_sec_bg_hov]" aria-label="' . esc_attr__('Change the color of the cookie bar secondary button', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_btn_sec_col_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_btn_sec_col']) ? $options['seopress_google_analytics_cb_btn_sec_col'] : null; ?>

<p class="description">
    <?php esc_attr_e('Text color: ', 'wp-seopress'); ?>
</p>

<?php
    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_btn_sec_col]" aria-label="' . esc_attr__('Change the color of the cookie bar secondary button hover background', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_cb_btn_sec_col_hov_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_cb_btn_sec_col_hov']) ? $options['seopress_google_analytics_cb_btn_sec_col_hov'] : null; ?>

<p class="description">
    <?php esc_attr_e('Text color on hover: ', 'wp-seopress'); ?>
</p>

<?php
    printf(
'<input type="text" data-default-color="#FFFFFF" name="seopress_google_analytics_option_name[seopress_google_analytics_cb_btn_sec_col_hov]" aria-label="' . esc_attr__('Change the color of the cookie bar secondary button hover', 'wp-seopress') . '" value="%s" class="color-picker"/>',
esc_html($check)
);
}

function seopress_google_analytics_roles_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    global $wp_roles;

    if ( ! isset($wp_roles)) {
        $wp_roles = new WP_Roles();
    }

    foreach ($wp_roles->get_names() as $key => $value) {
        $check = isset($options['seopress_google_analytics_roles'][$key]); ?>

<p>
    <label for="seopress_google_analytics_roles_<?php echo esc_attr($key); ?>">
        <input
            id="seopress_google_analytics_roles_<?php echo esc_attr($key); ?>"
            name="seopress_google_analytics_option_name[seopress_google_analytics_roles][<?php echo esc_attr($key); ?>]"
            type="checkbox" <?php if ('1' == $check) { ?>
        checked="yes"
        <?php } ?>
        value="1"/>
        <strong><?php echo esc_html($value); ?></strong> (<em><?php echo esc_html(translate_user_role($value,  'default')); ?></em>)
    </label>
</p>

<?php
        if (isset($options['seopress_google_analytics_roles'][$key])) {
            esc_attr($options['seopress_google_analytics_roles'][$key]);
        }
    }
}

function seopress_google_analytics_ads_callback() {
    $docs    = seopress_get_docs_links();
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_ads']) ? $options['seopress_google_analytics_ads'] : null; ?>

<?php
    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_ads]" placeholder="' . esc_html__('Enter your Google Ads conversion ID (e.g. AW-123456789)', 'wp-seopress') . '" value="%s" aria-label="' . esc_attr__('AW-XXXXXXXXX', 'wp-seopress') . '"/>',
esc_html($check)); ?>
<p class="description">
    <a class="seopress-help" href="<?php echo esc_url($docs['analytics']['gads']); ?>" target="_blank">
        <?php esc_attr_e('Learn how to find your Google Ads Conversion ID', 'wp-seopress'); ?>
    </a>
    <span class="seopress-help dashicons dashicons-external"></span>
</p>

<?php
}

function seopress_google_analytics_other_tracking_callback() {
    if (current_user_can('unfiltered_html')) {
        $options = get_option('seopress_google_analytics_option_name');
        $check   = isset($options['seopress_google_analytics_other_tracking']) ? $options['seopress_google_analytics_other_tracking'] : '';

        printf('<textarea id="seopress_google_analytics_other_tracking" name="seopress_google_analytics_option_name[seopress_google_analytics_other_tracking]" rows="16" placeholder="' . esc_html__('Paste your tracking code here like Google Tag Manager (head). Do NOT paste GA4 or Matomo codes here. They are automatically added to your source code.', 'wp-seopress') . '" aria-label="' . esc_attr__('Additional tracking code field', 'wp-seopress') . '">%s</textarea>', esc_textarea($check));
        ?>

        <p class="description">
            <?php esc_attr_e('This code will be added in the head section of your page.', 'wp-seopress'); ?>
        </p>
    <?php } else { ?>
        <input type="hidden" name="seopress_google_analytics_option_name[seopress_google_analytics_other_tracking]" value="none" />

        <div class="seopress-notice">
            <p>
                <?php /* translators: %$ name of the user capability "unfiltered_html" */ echo wp_kses_post(sprintf(__('Only users with %s capability can edit this field.', 'wp-seopress'), '<code>unfiltered_html</code>')); ?>
            </p>
        </div>
    <?php }
}

function seopress_google_analytics_other_tracking_body_callback() {
    $docs    = seopress_get_docs_links();
    if (current_user_can('unfiltered_html')) {
        $options = get_option('seopress_google_analytics_option_name');
        $check   = isset($options['seopress_google_analytics_other_tracking_body']) ? $options['seopress_google_analytics_other_tracking_body'] : '';

        printf(
        '<textarea id="seopress_google_analytics_other_tracking_body" name="seopress_google_analytics_option_name[seopress_google_analytics_other_tracking_body]" rows="16" placeholder="' . esc_html__('Paste your tracking code here like Google Tag Manager (body)', 'wp-seopress') . '" aria-label="' . esc_attr__('Additional tracking code field added to body', 'wp-seopress') . '">%s</textarea>',
        esc_textarea($check)); ?>
        <p class="description"><?php esc_attr_e('This code will be added just after the opening body tag of your page.', 'wp-seopress'); ?></p>

        <p class="description"><?php echo wp_kses_post(__('You don‘t see your code? Make sure to call <code>wp_body_open();</code> just after the opening body tag in your theme.', 'wp-seopress')); ?></p>
    <?php } else { ?>
        <input type="hidden" name="seopress_google_analytics_option_name[seopress_google_analytics_other_tracking_body]" value="none" />

        <div class="seopress-notice">
            <p>
                <?php /* translators: %$ name of the user capability "unfiltered_html" */ echo wp_kses_post(sprintf(__('Only users with %s capability can edit this field.', 'wp-seopress'), '<code>unfiltered_html</code>')); ?>
            </p>
        </div>
    <?php } ?>

<p class="description">
    <a class="seopress-help"
        href="<?php echo esc_url($docs['analytics']['gtm']); ?>"
        target="_blank">
        <?php esc_attr_e('Learn how to integrate Google Tag Manager', 'wp-seopress'); ?>
    </a>
    <span class="seopress-help dashicons dashicons-external"></span>
</p>

<?php
}

function seopress_google_analytics_other_tracking_footer_callback() {
    if (current_user_can('unfiltered_html')) {
        $options = get_option('seopress_google_analytics_option_name');
        $check   = isset($options['seopress_google_analytics_other_tracking_footer']) ? $options['seopress_google_analytics_other_tracking_footer'] : '';

        printf(
        '<textarea id="seopress_google_analytics_other_tracking_footer" name="seopress_google_analytics_option_name[seopress_google_analytics_other_tracking_footer]" rows="16" placeholder="' . esc_html__('Paste your tracking code here (footer)', 'wp-seopress') . '" aria-label="' . esc_attr__('Additional tracking code field added to footer', 'wp-seopress') . '">%s</textarea>',
        esc_textarea($check)); ?>

        <p class="description">
            <?php esc_attr_e('This code will be added just after the closing body tag of your page.', 'wp-seopress'); ?>
        </p>
    <?php } else { ?>
        <input type="hidden" name="seopress_google_analytics_option_name[seopress_google_analytics_other_tracking_footer]" value="none" />

        <div class="seopress-notice">
            <p>
                <?php /* translators: %$ name of the user capability "unfiltered_html" */ echo wp_kses_post(sprintf(__('Only users with %s capability can edit this field.', 'wp-seopress'), '<code>unfiltered_html</code>')); ?>
            </p>
        </div>
    <?php } ?>
<?php
}

function seopress_google_analytics_link_tracking_enable_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_link_tracking_enable']); ?>

<label for="seopress_google_analytics_link_tracking_enable">
    <input id="seopress_google_analytics_link_tracking_enable"
        name="seopress_google_analytics_option_name[seopress_google_analytics_link_tracking_enable]" type="checkbox"
        <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Enable external links tracking', 'wp-seopress'); ?>
</label>

<?php if (isset($options['seopress_google_analytics_link_tracking_enable'])) {
        esc_attr($options['seopress_google_analytics_link_tracking_enable']);
    }
}

function seopress_google_analytics_download_tracking_enable_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_download_tracking_enable']); ?>

<label for="seopress_google_analytics_download_tracking_enable">
    <input id="seopress_google_analytics_download_tracking_enable"
        name="seopress_google_analytics_option_name[seopress_google_analytics_download_tracking_enable]" type="checkbox"
        <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Enable download tracking', 'wp-seopress'); ?>
</label>

<?php if (isset($options['seopress_google_analytics_download_tracking_enable'])) {
        esc_attr($options['seopress_google_analytics_download_tracking_enable']);
    }
}

function seopress_google_analytics_download_tracking_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_download_tracking']) ? $options['seopress_google_analytics_download_tracking'] : null;

    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_download_tracking]" placeholder="' . esc_html__('pdf|docx|pptx|zip', 'wp-seopress') . '" aria-label="' . esc_attr__('Track downloads\' clicks', 'wp-seopress') . '" value="%s"/>',
esc_html($check)
); ?>
<p class="description">
    <?php esc_attr_e('Separate each file type extensions with a pipe "|"', 'wp-seopress'); ?>
</p>

<?php
}

function seopress_google_analytics_affiliate_tracking_enable_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_affiliate_tracking_enable']); ?>

<label for="seopress_google_analytics_affiliate_tracking_enable">
    <input id="seopress_google_analytics_affiliate_tracking_enable"
        name="seopress_google_analytics_option_name[seopress_google_analytics_affiliate_tracking_enable]"
        type="checkbox" <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Enable affiliate/outbound tracking', 'wp-seopress'); ?>
</label>

<?php
    if (isset($options['seopress_google_analytics_affiliate_tracking_enable'])) {
        esc_attr($options['seopress_google_analytics_affiliate_tracking_enable']);
    }
}

function seopress_google_analytics_affiliate_tracking_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_affiliate_tracking']) ? $options['seopress_google_analytics_affiliate_tracking'] : null;

    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_affiliate_tracking]" placeholder="' . esc_html__('aff|go|out', 'wp-seopress') . '" aria-label="' . esc_attr__('Track affiliate/outbound links', 'wp-seopress') . '" value="%s"/>',
esc_html($check)
); ?>
<p class="description">
    <?php esc_attr_e('Separate each keyword with a pipe "|"', 'wp-seopress'); ?>
</p>
<?php
}

function seopress_google_analytics_phone_tracking_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_phone_tracking']); ?>

<label for="seopress_google_analytics_phone_tracking">
    <input id="seopress_google_analytics_phone_tracking"
        name="seopress_google_analytics_option_name[seopress_google_analytics_phone_tracking]"
        type="checkbox" <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Enable tracking of "tel:" links', 'wp-seopress'); ?>
</label>

<p class="description">
    <pre>&lt;a href="tel:+33123456789"&gt;</pre>
</p>

<?php
    if (isset($options['seopress_google_analytics_phone_tracking'])) {
        esc_attr($options['seopress_google_analytics_phone_tracking']);
    }
}

function seopress_google_analytics_cd_author_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $selected = isset($options['seopress_google_analytics_cd_author']) ? $options['seopress_google_analytics_cd_author'] : null; ?>
<select id="seopress_google_analytics_cd_author"
    name="seopress_google_analytics_option_name[seopress_google_analytics_cd_author]">
    <option <?php if ('none' === esc_attr($selected)) { ?>
        selected="selected"
        <?php } ?>
        value="none"><?php esc_attr_e('None', 'wp-seopress'); ?>
    </option>

    <?php for ($i=1; $i <= 20; ++$i) { ?>
    <option <?php if ('dimension' . intval($i) . '' == esc_attr($selected)) { ?>
        selected="selected"
        <?php } ?>
        value="dimension<?php echo intval($i); ?>"><?php /* translators: %d dimension number number, eg: #1 */ printf(esc_html__('Custom Dimension #%d', 'wp-seopress'), intval($i)); ?>
    </option>
    <?php } ?>
</select>

<?php if (isset($options['seopress_google_analytics_cd_author'])) {
        esc_attr($options['seopress_google_analytics_cd_author']);
    }
}

function seopress_google_analytics_cd_category_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $selected = isset($options['seopress_google_analytics_cd_category']) ? $options['seopress_google_analytics_cd_category'] : null; ?>
<select id="seopress_google_analytics_cd_category"
    name="seopress_google_analytics_option_name[seopress_google_analytics_cd_category]">
    <option <?php if ('none' === esc_attr($selected)) { ?>
        selected="selected"
        <?php } ?>
        value="none"><?php esc_attr_e('None', 'wp-seopress'); ?>
    </option>

    <?php for ($i=1; $i <= 20; ++$i) { ?>
        <option <?php if ('dimension' . intval($i) . '' == esc_attr($selected)) { ?>
        selected="selected"
        <?php } ?>
        value="dimension<?php echo intval($i); ?>"><?php /* translators: %d dimension number number, eg: #1 */ printf(esc_html__('Custom Dimension #%d', 'wp-seopress'), intval($i)); ?>
    </option>
    <?php } ?>
</select>

<?php if (isset($options['seopress_google_analytics_cd_category'])) {
        esc_attr($options['seopress_google_analytics_cd_category']);
    }
}

function seopress_google_analytics_cd_tag_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $selected = isset($options['seopress_google_analytics_cd_tag']) ? $options['seopress_google_analytics_cd_tag'] : null; ?>

<select id="seopress_google_analytics_cd_tag"
    name="seopress_google_analytics_option_name[seopress_google_analytics_cd_tag]">
    <option <?php if ('none' === esc_attr($selected)) { ?>
        selected="selected"
        <?php } ?>
        value="none"><?php esc_attr_e('None', 'wp-seopress'); ?>
    </option>

    <?php for ($i=1; $i <= 20; ++$i) { ?>
    <option <?php if ('dimension' . intval($i) . '' == esc_attr($selected)) { ?>
        selected="selected"
        <?php } ?>
        value="dimension<?php echo intval($i); ?>"><?php /* translators: %d dimension number number, eg: #1 */ printf(esc_html__('Custom Dimension #%d', 'wp-seopress'), intval($i)); ?>
    </option>
    <?php } ?>
</select>

<?php if (isset($options['seopress_google_analytics_cd_tag'])) {
        esc_attr($options['seopress_google_analytics_cd_tag']);
    }
}

function seopress_google_analytics_cd_post_type_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $selected = isset($options['seopress_google_analytics_cd_post_type']) ? $options['seopress_google_analytics_cd_post_type'] : null; ?>

<select id="seopress_google_analytics_cd_post_type"
    name="seopress_google_analytics_option_name[seopress_google_analytics_cd_post_type]">
    <option <?php if ('none' === esc_attr($selected)) { ?>
        selected="selected"
        <?php } ?>
        value="none"><?php esc_attr_e('None', 'wp-seopress'); ?>
    </option>

    <?php for ($i=1; $i <= 20; ++$i) { ?>
    <option <?php if ('dimension' . intval($i) . '' == esc_attr($selected)) { ?>
        selected="selected"
        <?php } ?>
        value="dimension<?php echo intval($i); ?>"><?php /* translators: %d dimension number number, eg: #1 */ printf(esc_html__('Custom Dimension #%d', 'wp-seopress'), intval($i)); ?>
    </option>
    <?php } ?>
</select>
<?php
if (isset($options['seopress_google_analytics_cd_post_type'])) {
        esc_attr($options['seopress_google_analytics_cd_post_type']);
    }
}

function seopress_google_analytics_cd_logged_in_user_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $selected = isset($options['seopress_google_analytics_cd_logged_in_user']) ?
    $options['seopress_google_analytics_cd_logged_in_user'] : null; ?>

<select id="seopress_google_analytics_cd_logged_in_user"
    name="seopress_google_analytics_option_name[seopress_google_analytics_cd_logged_in_user]">
    <option <?php if (' none' === esc_attr($selected)) { ?>
        selected="selected"
        <?php } ?>
        value="none"><?php esc_attr_e('None', 'wp-seopress'); ?>
    </option>
    <?php for ($i=1; $i <= 20; ++$i) { ?>
    <option <?php if ('dimension' . intval($i) . '' == esc_attr($selected)) { ?>
        selected="selected"
        <?php } ?>
        value="dimension<?php echo intval($i); ?>"><?php /* translators: %d dimension number number, eg: #1 */ printf(esc_html__('Custom Dimension #%d', 'wp-seopress'), intval($i)); ?>
    </option>
    <?php } ?>
</select>
<?php if (isset($options['seopress_google_analytics_cd_logged_in_user'])) {
        esc_attr($options['seopress_google_analytics_cd_logged_in_user']);
    }
}
function seopress_google_analytics_matomo_enable_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_matomo_enable']); ?>


<label for="seopress_google_analytics_matomo_enable">
    <input id="seopress_google_analytics_matomo_enable"
        name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_enable]" type="checkbox" <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>

    <?php esc_attr_e('Enable Matomo tracking', 'wp-seopress'); ?>
    <p class="description">
        <?php esc_attr_e('A Matomo Cloud account or a self hosted Matomo installation is required.', 'wp-seopress'); ?>
    </p>
</label>

<?php if (isset($options['seopress_google_analytics_matomo_enable'])) {
        esc_attr($options['seopress_google_analytics_matomo_enable']);
    }
}

function seopress_google_analytics_matomo_self_hosted_callback() {
    $docs = seopress_get_docs_links();
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_matomo_self_hosted']); ?>


<label for="seopress_google_analytics_matomo_self_hosted">
    <input id="seopress_google_analytics_matomo_self_hosted"
        name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_self_hosted]" type="checkbox" <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>

    <?php esc_attr_e('Yes, self-hosted installation', 'wp-seopress'); ?>
    <p class="description">
        <?php esc_attr_e('If you use Matomo Cloud, uncheck this option.', 'wp-seopress'); ?>
    </p>
    <p class="description">
        <span class="dashicons dashicons-external seopress-help"></span>
        <?php printf('<a href="%s" target="_blank" class="seopress-help">'.esc_attr__('Learn how to install Matomo On-Premise on your server.', 'wp-seopress').'</a>', esc_url($docs['analytics']['matomo']['on_premise'])); ?>
    </p>
</label>

<?php if (isset($options['seopress_google_analytics_matomo_self_hosted'])) {
        esc_attr($options['seopress_google_analytics_matomo_self_hosted']);
    }
}

function seopress_google_analytics_matomo_id_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_matomo_id']) ? $options['seopress_google_analytics_matomo_id'] : null;

    printf('<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_id]" placeholder="'
        . esc_html__('Enter "example" if you Matomo account URL is "example.matomo.cloud"', ' wp-seopress')
        . '" value="%s" aria-label="' . esc_attr__('Matomo URL (Cloud or Self-hosted)', 'wp-seopress') . '"/>', esc_html($check)); ?>

<p class="description">
    <?php echo wp_kses_post(__('Enter only the <strong>host without the quotes</strong> like this <code>"example.matomo.cloud"</code> (Cloud) or <code>"matomo.example.com"</code> (self-hosted).', 'wp-seopress')); ?>
</p>

<?php
}

function seopress_google_analytics_matomo_site_id_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check = isset($options['seopress_google_analytics_matomo_site_id']) ? $options['seopress_google_analytics_matomo_site_id'] : null;

    printf(
        '<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_site_id]"
            placeholder="' . esc_html__('Enter your site ID here', 'wp-seopress') . '" value="%s"
            aria-label="' . esc_attr__('Matomo Site ID', 'wp-seopress') . '" />',
        esc_html($check)
        ); ?>

<p class="description">
    <?php echo wp_kses_post(__('To find your site ID, go to your <strong>Matomo Cloud account, Websites, Manage page</strong>. Look at "Site ID" on the right part.', 'wp-seopress')); ?><br>
    <?php esc_attr_e('For self-hosted installations, go to your Matomo administration, Settings, Websites, Manage. From the list of your websites, find the ID line.', 'wp-seopress'); ?>
</p>
<?php
}

function seopress_google_analytics_matomo_subdomains_callback() {
    $options = get_option('seopress_google_analytics_option_name');

    $check = isset($options['seopress_google_analytics_matomo_subdomains']); ?>

<label for="seopress_google_analytics_matomo_subdomains">
    <input id="seopress_google_analytics_matomo_subdomains"
        name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_subdomains]" type="checkbox"
        <?php if (' 1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Tracking one domain and its subdomains in the same website', 'wp-seopress'); ?>
</label>

<p class="description">
    <?php esc_attr_e('If one visitor visits x.example.com and y.example.com, they will be counted as a unique visitor.', 'wp-seopress'); ?>
</p>

<?php if (isset($options['seopress_google_analytics_matomo_subdomains'])) {
        esc_attr($options['seopress_google_analytics_matomo_subdomains']);
    }
}

function seopress_google_analytics_matomo_site_domain_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_matomo_site_domain']); ?>

<label for="seopress_google_analytics_matomo_site_domain">
    <input id="seopress_google_analytics_matomo_site_domain"
        name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_site_domain]" type="checkbox"
        <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Prepend the site domain to the page title when tracking', 'wp-seopress'); ?>
</label>
<p class="description">
    <?php esc_attr_e('If someone visits the \'About\' page on blog.example.com it will be recorded as \'blog / About\'. This is the easiest way to get an overview of your traffic by sub-domain.', 'wp-seopress'); ?>
</p>

<?php if (isset($options['seopress_google_analytics_matomo_site_domain'])) {
        esc_attr($options['seopress_google_analytics_matomo_site_domain']);
    }
}

function seopress_google_analytics_matomo_no_js_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_matomo_no_js']); ?>

<label for="seopress_google_analytics_matomo_no_js">
    <input id="seopress_google_analytics_matomo_no_js"
        name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_no_js]" type="checkbox" <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Track users with JavaScript disabled', 'wp-seopress'); ?>
</label>

<?php if (isset($options['seopress_google_analytics_matomo_no_js'])) {
        esc_attr($options['seopress_google_analytics_matomo_no_js']);
    }
}

function seopress_google_analytics_matomo_cross_domain_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_matomo_cross_domain']); ?>

<label for="seopress_google_analytics_matomo_cross_domain">
    <input id="seopress_google_analytics_matomo_cross_domain"
        name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_cross_domain]" type="checkbox"
        <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Enables cross domain linking', 'wp-seopress'); ?>
</label>

<p class="description">
    <?php esc_attr_e('By default, the visitor ID that identifies a unique visitor is stored in the browser\'s first party cookies which can only be accessed by pages on the same domain.', 'wp-seopress'); ?>
</p>
<p class="description">
    <?php esc_attr_e('Enabling cross domain linking lets you track all the actions and pageviews of a specific visitor into the same visit even when they view pages on several domains.', 'wp-seopress'); ?>
</p>
<p class="description">
    <?php esc_attr_e('Whenever a user clicks on a link to one of your website\'s alias URLs, it will append a URL parameter pk_vid forwarding the Visitor ID.', 'wp-seopress'); ?>
</p>

<?php if (isset($options['seopress_google_analytics_matomo_cross_domain'])) {
        esc_attr($options['seopress_google_analytics_matomo_cross_domain']);
    }
}

function seopress_google_analytics_matomo_cross_domain_sites_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_matomo_cross_domain_sites']) ? $options['seopress_google_analytics_matomo_cross_domain_sites'] : null;

    printf('<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_cross_domain_sites]" placeholder="'
            . esc_html__('Enter your domains: seopress.org,sub.seopress.org,sub2.seopress.org', 'wp-seopress')
            . '" value="%s" aria-label="' . esc_attr__('Cross domains', 'wp-seopress') . '"/>', esc_html($check));
}

function seopress_google_analytics_matomo_dnt_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_matomo_dnt']); ?>

<label for="seopress_google_analytics_matomo_dnt">
    <input id="seopress_google_analytics_matomo_dnt"
        name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_dnt]" type="checkbox" <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Enable client side DoNotTrack detection', 'wp-seopress'); ?>
</label>

<p class="description">
    <?php esc_attr_e('Tracking requests will not be sent if visitors do not wish to be tracked.', 'wp-seopress'); ?>
</p>

<?php
    if (isset($options['seopress_google_analytics_matomo_dnt'])) {
        esc_attr($options['seopress_google_analytics_matomo_dnt']);
    }
}

function seopress_google_analytics_matomo_no_cookies_callback() {
    $options    =   get_option('seopress_google_analytics_option_name');
    $check      =   isset($options['seopress_google_analytics_matomo_no_cookies']); ?>

<label for="seopress_google_analytics_matomo_no_cookies">
    <input id="seopress_google_analytics_matomo_no_cookies"
        name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_no_cookies]" type="checkbox"
        <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Disables all first party cookies. Existing Matomo cookies for this website will be deleted on the next page view.', 'wp-seopress'); ?>
</label>

<?php if (isset($options['seopress_google_analytics_matomo_no_cookies'])) {
        esc_attr($options['seopress_google_analytics_matomo_no_cookies']);
    }
}

function seopress_google_analytics_matomo_link_tracking_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_matomo_link_tracking']); ?>

<label for="seopress_google_analytics_matomo_link_tracking">
    <input id="seopress_google_analytics_matomo_link_tracking"
        name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_link_tracking]" type="checkbox"
        <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Enabling Download & Outlink tracking', 'wp-seopress'); ?>
</label>

<p class="description">
    <?php esc_attr_e('By default, any file ending with one of these extensions will be considered a "download" in the Matomo interface:','wp-seopress'); ?><br>
</p>

<pre>7z|aac|arc|arj|apk|asf|asx|avi|bin|bz|bz2|csv|deb|dmg|doc|exe|flv|gif|gz|gzip|hqx|jar|jpg|jpeg|js|mp2|mp3|mp4|mpg|mpeg|mov|movie|msi|msp|odb|odf|odg|odp|ods|odt|ogg|ogv| pdf|phps|png|ppt|qt|qtm|ra|ram|rar|rpm|sea|sit|tar|tbz|tbz2|tgz|torrent|txt|wav|wma|wmv|wpd|xls|xml|z|zip</pre>

<?php
    if (isset($options['seopress_google_analytics_matomo_link_tracking'])) {
        esc_attr($options['seopress_google_analytics_matomo_link_tracking']);
    }
}

function seopress_google_analytics_matomo_no_heatmaps_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_matomo_no_heatmaps']); ?>

<label for="seopress_google_analytics_matomo_no_heatmaps">
    <input id="seopress_google_analytics_matomo_no_heatmaps"
        name="seopress_google_analytics_option_name[seopress_google_analytics_matomo_no_heatmaps]" type="checkbox"
        <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Disabling all heatmaps and session recordings', 'wp-seopress'); ?>
</label>

<?php if (isset($options['seopress_google_analytics_matomo_no_heatmaps'])) {
        esc_attr($options['seopress_google_analytics_matomo_no_heatmaps']);
    }
}

function seopress_google_analytics_clarity_enable_callback() {
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_clarity_enable']); ?>


<label for="seopress_google_analytics_clarity_enable">
    <input id="seopress_google_analytics_clarity_enable"
        name="seopress_google_analytics_option_name[seopress_google_analytics_clarity_enable]" type="checkbox" <?php if ('1' == $check) { ?>
    checked="yes"
    <?php } ?>
    value="1"/>
    <?php esc_attr_e('Add Microsoft Clarity code to your site', 'wp-seopress'); ?>
</label>

<?php if (isset($options['seopress_google_analytics_clarity_enable'])) {
        esc_attr($options['seopress_google_analytics_clarity_enable']);
    }
}

function seopress_google_analytics_clarity_project_id_callback() {
    $docs = seopress_get_docs_links();
    $options = get_option('seopress_google_analytics_option_name');
    $check   = isset($options['seopress_google_analytics_clarity_project_id']) ? $options['seopress_google_analytics_clarity_project_id'] : null;

    printf(
'<input type="text" name="seopress_google_analytics_option_name[seopress_google_analytics_clarity_project_id]" placeholder="' . esc_html__('Enter your Project ID', 'wp-seopress') . '" aria-label="' . esc_attr__('Enter your Project ID', 'wp-seopress') . '" value="%s"/>',
esc_html($check)
); ?>

<p class="seopress-help description">
    <span class="dashicons dashicons-external"></span>
    <a href="<?php echo esc_url($docs['analytics']['clarity']['project']); ?>" target="_blank">
        <?php esc_attr_e('Find your project ID', 'wp-seopress'); ?>
    </a>
</p>
<?php
}
