Initial commit: ATT Consent plugin v1.0.0

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>
This commit is contained in:
2026-02-16 05:45:42 +00:00
commit 6bf9f553de
19 changed files with 2726 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
<?php
/**
* Advanced 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="advanced">
<table class="form-table">
<tr>
<th scope="row"><?php esc_html_e( 'URL Passthrough', 'att-consent' ); ?></th>
<td>
<label>
<input type="checkbox" name="url_passthrough" value="1" <?php checked( $settings['url_passthrough'] ); ?>>
<?php esc_html_e( 'Enable URL passthrough', 'att-consent' ); ?>
</label>
<p class="description">
<?php esc_html_e( 'Passes ad click information (gclid, dclid) through URL parameters when navigating between pages, even before consent is granted. Recommended for better conversion attribution.', 'att-consent' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e( 'Ads Data Redaction', 'att-consent' ); ?></th>
<td>
<label>
<input type="checkbox" name="ads_data_redaction" value="1" <?php checked( $settings['ads_data_redaction'] ); ?>>
<?php esc_html_e( 'Enable ads data redaction', 'att-consent' ); ?>
</label>
<p class="description">
<?php esc_html_e( 'When ad_storage is denied, redacts ad click identifiers sent in network requests. Provides additional privacy protection.', 'att-consent' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="wait_for_update"><?php esc_html_e( 'Wait for Update (ms)', 'att-consent' ); ?></label>
</th>
<td>
<input type="number" name="wait_for_update" id="wait_for_update"
value="<?php echo esc_attr( $settings['wait_for_update'] ); ?>"
class="small-text" min="100" max="10000" step="100">
<p class="description">
<?php esc_html_e( 'How long Google tags wait for a consent update before firing with default (denied) state. 500ms is the recommended default. Only applies on first visit.', 'att-consent' ); ?>
</p>
</td>
</tr>
</table>
<h2><?php esc_html_e( 'Google Consent Mode v2 Signal Reference', 'att-consent' ); ?></h2>
<table class="widefat fixed" style="max-width: 700px;">
<thead>
<tr>
<th><?php esc_html_e( 'Consent Category', 'att-consent' ); ?></th>
<th><?php esc_html_e( 'Google Consent Signals', 'att-consent' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong><?php esc_html_e( 'Necessary', 'att-consent' ); ?></strong></td>
<td><code>security_storage</code> <?php esc_html_e( '(always granted)', 'att-consent' ); ?></td>
</tr>
<tr>
<td><strong><?php esc_html_e( 'Functional', 'att-consent' ); ?></strong></td>
<td><code>functionality_storage</code>, <code>personalization_storage</code></td>
</tr>
<tr>
<td><strong><?php esc_html_e( 'Analytics', 'att-consent' ); ?></strong></td>
<td><code>analytics_storage</code></td>
</tr>
<tr>
<td><strong><?php esc_html_e( 'Marketing', 'att-consent' ); ?></strong></td>
<td><code>ad_storage</code>, <code>ad_user_data</code>, <code>ad_personalization</code></td>
</tr>
</tbody>
</table>
<?php submit_button(); ?>
</form>