Google Consent Mode v2 cookie consent plugin with session attribution preservation, custom script management, and gtag.js/GTM support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
121 lines
4.1 KiB
PHP
121 lines
4.1 KiB
PHP
<?php
|
|
/**
|
|
* General settings tab.
|
|
*
|
|
* @package ATT_Consent
|
|
* @var array $settings Current settings.
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
?>
|
|
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
|
|
<?php wp_nonce_field( 'att_cc_save_settings' ); ?>
|
|
<input type="hidden" name="action" value="att_cc_save_settings">
|
|
<input type="hidden" name="att_cc_tab" value="general">
|
|
|
|
<table class="form-table">
|
|
<tr>
|
|
<th scope="row">
|
|
<label for="tracking_mode"><?php esc_html_e( 'Tracking Mode', 'att-consent' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<select name="tracking_mode" id="tracking_mode">
|
|
<option value="gtag" <?php selected( $settings['tracking_mode'], 'gtag' ); ?>>
|
|
<?php esc_html_e( 'Google Analytics (gtag.js)', 'att-consent' ); ?>
|
|
</option>
|
|
<option value="gtm" <?php selected( $settings['tracking_mode'], 'gtm' ); ?>>
|
|
<?php esc_html_e( 'Google Tag Manager', 'att-consent' ); ?>
|
|
</option>
|
|
</select>
|
|
<p class="description">
|
|
<?php esc_html_e( 'Choose whether to inject gtag.js directly or use a GTM container.', 'att-consent' ); ?>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr class="att-cc-gtag-row">
|
|
<th scope="row">
|
|
<label for="ga4_measurement_id"><?php esc_html_e( 'GA4 Measurement ID', 'att-consent' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<input type="text" name="ga4_measurement_id" id="ga4_measurement_id"
|
|
value="<?php echo esc_attr( $settings['ga4_measurement_id'] ); ?>"
|
|
class="regular-text" placeholder="G-XXXXXXXXXX">
|
|
<p class="description">
|
|
<?php esc_html_e( 'Your GA4 Measurement ID (starts with G-).', 'att-consent' ); ?>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr class="att-cc-gtm-row">
|
|
<th scope="row">
|
|
<label for="gtm_container_id"><?php esc_html_e( 'GTM Container ID', 'att-consent' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<input type="text" name="gtm_container_id" id="gtm_container_id"
|
|
value="<?php echo esc_attr( $settings['gtm_container_id'] ); ?>"
|
|
class="regular-text" placeholder="GTM-XXXXXXX">
|
|
<p class="description">
|
|
<?php esc_html_e( 'Your Google Tag Manager Container ID (starts with GTM-).', 'att-consent' ); ?>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<th scope="row">
|
|
<label for="consent_mode"><?php esc_html_e( 'Consent Mode', 'att-consent' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<select name="consent_mode" id="consent_mode">
|
|
<option value="advanced" <?php selected( $settings['consent_mode'], 'advanced' ); ?>>
|
|
<?php esc_html_e( 'Advanced (recommended)', 'att-consent' ); ?>
|
|
</option>
|
|
<option value="basic" <?php selected( $settings['consent_mode'], 'basic' ); ?>>
|
|
<?php esc_html_e( 'Basic', 'att-consent' ); ?>
|
|
</option>
|
|
</select>
|
|
<p class="description">
|
|
<?php esc_html_e( 'Advanced: Tags load before consent, sending cookieless pings for better modelling. Basic: No tags load until consent is given.', 'att-consent' ); ?>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<th scope="row">
|
|
<label for="banner_position"><?php esc_html_e( 'Banner Position', 'att-consent' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<select name="banner_position" id="banner_position">
|
|
<option value="bottom" <?php selected( $settings['banner_position'], 'bottom' ); ?>>
|
|
<?php esc_html_e( 'Bottom Bar', 'att-consent' ); ?>
|
|
</option>
|
|
<option value="top" <?php selected( $settings['banner_position'], 'top' ); ?>>
|
|
<?php esc_html_e( 'Top Bar', 'att-consent' ); ?>
|
|
</option>
|
|
<option value="center" <?php selected( $settings['banner_position'], 'center' ); ?>>
|
|
<?php esc_html_e( 'Centre Modal', 'att-consent' ); ?>
|
|
</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<th scope="row">
|
|
<label for="consent_expiry"><?php esc_html_e( 'Consent Expiry (days)', 'att-consent' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<input type="number" name="consent_expiry" id="consent_expiry"
|
|
value="<?php echo esc_attr( $settings['consent_expiry'] ); ?>"
|
|
class="small-text" min="1" max="730">
|
|
<p class="description">
|
|
<?php esc_html_e( 'How long the consent cookie lasts before the user is asked again.', 'att-consent' ); ?>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<?php submit_button(); ?>
|
|
</form>
|