first commit

This commit is contained in:
2026-04-28 15:13:50 +02:00
commit a95acc355b
63745 changed files with 9487948 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
/* GA Google Analytics */
.wp-admin .gap-panel-overview {
box-sizing: border-box; width: 100%; overflow: hidden; position: relative; padding: 0 15px 10px 100px;
background-image: url(../img/ga-icon-160x160.png); background-repeat: no-repeat; background-position: 15px 15px; background-size: 80px 80px;
}
.wp-admin .gap-col-1 { width: 100%; float: left; }
.wp-admin .gap-col-2 { width: 33%; float: right; position: absolute; bottom: 0; right: 0; background-color: #fce586; background-image: linear-gradient(to right, #fce586, #fff); }
.wp-admin .gap-panel-usage .gap-caption { margin: 15px; }
@media (max-width: 880px) {
.wp-admin .gap-col-1 { width: 60%; }
}
@media (max-width: 660px) {
.wp-admin .gap-col-1, .wp-admin .gap-col-2 { width: 100%; float: none; position: static; }
.wp-admin .gap-col-2 { padding: 5px 15px 5px 0; }
}
.wp-admin .notice code { line-height: 1; font-size: 12px; }
.wp-admin .gap-dismiss-notice { float: right; }
@media (max-width: 1100px) {
.wp-admin .gap-dismiss-notice { float: none; }
}
.wp-admin .notice-lh p { line-height: 1.8; }
.wp-admin .notice-custom { background-image: url(../img/sun-icon.png); background-repeat: no-repeat; background-position: left 5px center; background-size: 60px 40px; }
.wp-admin .notice-custom p { margin: 15px 0; padding-left: 60px; line-height: 1.6; }
.wp-admin .notice-link { display: inline-block; margin-right: 5px; }
@media (max-width: 782px) {
.wp-admin .notice-custom p { margin: 10px 0; }
}
.wp-admin .wrap h1 small { line-height: 12px; font-size: 12px; color: #bbb; }
.wp-admin .wrap form h2 { margin: 0; padding: 12px 0 12px 15px; font-size: 16px; cursor: pointer; }
.wp-admin .wrap form p { margin: 15px; }
.wp-admin .wrap form ul { list-style-type: disc; }
.wp-admin .wrap form ul,
.wp-admin .wrap form ol { margin: 15px 15px 15px 40px; }
.wp-admin .wrap form li { margin: 10px 0; }
.wp-admin .gap-panel-settings { margin: 0 15px 15px 15px; }
.wp-admin .gap-panel-settings table { border: 0; }
.wp-admin .gap-panel-settings th { width: 25%; vertical-align: middle; }
.wp-admin .gap-panel-settings td { padding: 15px; vertical-align: middle; }
.wp-admin .gap-panel-settings td input[type=checkbox] { position: relative; top: -2px; }
.wp-admin .gap-panel-settings td textarea { box-sizing: border-box; width: 96%; }
.wp-admin .gap-panel-settings td textarea + .gap-caption { width: 95%; }
.wp-admin .gap-panel-settings td.ga-pro-info {
padding-left: 38px;
background-image: url(../img/ga-icon-160x160.png); background-repeat: no-repeat; background-position: 12px 14px; background-size: 20px 20px;
}
.wp-admin .wrap textarea { display: block; }
.wp-admin .wrap .gap-radio-inputs { margin: 7px 0; }
.wp-admin .wrap .button-primary { margin: 0 0 15px 15px; }
.wp-admin .wrap .gap-caption { line-height: 18px; font-size: 12px; padding: 5px 0 0 2px; color: #777; }
.wp-admin .wrap .gap-caption code { line-height: 18px; font-size: 11px; padding: 2px 3px; margin: 0; }
.wp-admin .wrap .toggle-link { margin: 0 2px; padding: 0 2px; }
.wp-admin .wrap .gap-note { color: #888; }
.wp-admin .wrap .gap-code { color: #777; background-color: #F7F7F7; padding: 1px 2px 2px 2px; border-radius: 1px; }
.wp-admin .gap-toggle-all { margin: 5px 0; }
.wp-admin .gap-credit-info { margin: -5px 0 0 3px; }
.wp-admin .wrap .gap-blurb { margin-top: 5px; padding: 15px; background-color: #FEFAE8; }
.wp-admin .wrap abbr[title] { cursor: help !important; border-bottom: 1px dotted #777 !important; text-decoration: none !important; }

View File

@@ -0,0 +1,644 @@
<?php
/*
Plugin Name: GA Google Analytics
Plugin URI: https://perishablepress.com/google-analytics-plugin/
Description: Adds your Google Analytics Tracking Code to your WordPress site.
Tags: analytics, google, google analytics, tracking, statistics
Author: Jeff Starr
Author URI: https://plugin-planet.com/
Donate link: https://monzillamedia.com/donate.html
Contributors: specialk
Requires at least: 4.7
Tested up to: 7.0
Stable tag: 20260421
Version: 20260421
Requires PHP: 5.6.20
Text Domain: ga-google-analytics
Domain Path: /languages
License: GPL v2 or later
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version
2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
with this program. If not, visit: https://www.gnu.org/licenses/
Copyright 2012-2026 Monzilla Media. All rights reserved.
*/
if (!defined('ABSPATH')) die();
if (!class_exists('GA_Google_Analytics')) {
class GA_Google_Analytics {
function __construct() {
$this->constants();
$this->includes();
register_activation_hook(__FILE__, array($this, 'check_gap_pro'));
register_activation_hook(__FILE__, array($this, 'dismiss_notice_activate'));
add_action('admin_menu', array($this, 'add_menu'));
add_filter('admin_init', array($this, 'add_settings'));
add_action('admin_enqueue_scripts', array($this, 'admin_scripts'));
add_filter('plugin_action_links', array($this, 'action_links'), 10, 2);
add_filter('plugin_row_meta', array($this, 'plugin_links'), 10, 2);
add_filter('admin_footer_text', array($this, 'footer_text'), 10, 1);
add_action('init', array($this, 'load_i18n'));
add_action('admin_init', array($this, 'dismiss_notice_save'));
add_action('admin_init', array($this, 'dismiss_notice_version'));
add_action('admin_init', array($this, 'check_version'));
add_action('admin_init', array($this, 'reset_options'));
add_action('admin_notices', array($this, 'admin_notices'));
}
function constants() {
if (!defined('GAP_VERSION')) define('GAP_VERSION', '20260421');
if (!defined('GAP_REQUIRE')) define('GAP_REQUIRE', '4.7');
if (!defined('GAP_AUTHOR')) define('GAP_AUTHOR', 'Jeff Starr');
if (!defined('GAP_NAME')) define('GAP_NAME', 'GA Google Analytics');
if (!defined('GAP_HOME')) define('GAP_HOME', 'https://perishablepress.com/ga-google-analytics/');
if (!defined('GAP_PATH')) define('GAP_PATH', 'options-general.php?page=ga-google-analytics');
if (!defined('GAP_URL')) define('GAP_URL', plugin_dir_url(__FILE__));
if (!defined('GAP_DIR')) define('GAP_DIR', plugin_dir_path(__FILE__));
if (!defined('GAP_FILE')) define('GAP_FILE', plugin_basename(__FILE__));
if (!defined('GAP_SLUG')) define('GAP_SLUG', basename(dirname(__FILE__)));
}
function includes() {
require_once GAP_DIR .'inc/plugin-core.php';
}
function add_menu() {
$title_page = esc_html__('GA Google Analytics', 'ga-google-analytics');
$title_menu = esc_html__('Google Analytics', 'ga-google-analytics');
add_options_page($title_page, $title_menu, 'manage_options', 'ga-google-analytics', array($this, 'display_settings'));
}
function add_settings() {
register_setting('gap_plugin_options', 'gap_options', array($this, 'validate_settings'));
}
function admin_scripts($hook) {
if ($hook === 'settings_page_ga-google-analytics') {
wp_enqueue_style('ga-google-analytics', GAP_URL .'css/settings.css', array(), GAP_VERSION);
wp_enqueue_script('ga-google-analytics', GAP_URL .'js/settings.js', array('jquery'), GAP_VERSION);
$this->localize_scripts();
}
}
function localize_scripts() {
$script = array(
'confirm_message' => esc_html__('Are you sure you want to restore all default options?', 'ga-google-analytics')
);
wp_localize_script('ga-google-analytics', 'ga_google_analytics', $script);
}
function action_links($links, $file) {
if ($file === GAP_FILE && current_user_can('manage_options')) {
$settings = '<a href="'. admin_url(GAP_PATH) .'">'. esc_html__('Settings', 'ga-google-analytics') .'</a>';
array_unshift($links, $settings);
}
if ($file === GAP_FILE) {
$pro_href = 'https://plugin-planet.com/ga-google-analytics-pro/';
$pro_title = esc_attr__('Get GA Pro!', 'ga-google-analytics');
$pro_text = esc_html__('Go&nbsp;Pro', 'ga-google-analytics');
$pro_style = 'padding:2px 4px;font-weight:bold;border:1px solid #00CCCC;border-radius:2px;background-color:#fff;';
$pro = '<a target="_blank" rel="noopener noreferrer" href="'. $pro_href .'" title="'. $pro_title .'" style="'. $pro_style .'">'. $pro_text .'</a>';
array_unshift($links, $pro);
}
return $links;
}
function plugin_links($links, $file) {
if ($file === GAP_FILE) {
$home_href = 'https://perishablepress.com/google-analytics-plugin/';
$home_title = esc_attr__('Plugin Homepage', 'ga-google-analytics');
$home_text = esc_html__('Homepage', 'ga-google-analytics');
$links[] = '<a target="_blank" rel="noopener noreferrer" href="'. $home_href .'" title="'. $home_title .'">'. $home_text .'</a>';
$rate_href = 'https://wordpress.org/support/plugin/'. GAP_SLUG .'/reviews/?rate=5#new-post';
$rate_title = esc_attr__('Click here to rate and review this plugin at WordPress.org', 'ga-google-analytics');
$rate_text = esc_html__('Rate this plugin', 'ga-google-analytics') .'&nbsp;&raquo;';
$links[] = '<a target="_blank" rel="noopener noreferrer" href="'. $rate_href .'" title="'. $rate_title .'">'. $rate_text .'</a>';
}
return $links;
}
function footer_text($text) {
$screen_id = $this->screen_id();
$ids = array('settings_page_ga-google-analytics');
if ($screen_id && apply_filters('ga_google_analytics_admin_footer_text', in_array($screen_id, $ids))) {
$text = __('Like this plugin? Give it a', 'ga-google-analytics');
$text .= ' <a target="_blank" rel="noopener noreferrer" href="https://wordpress.org/support/plugin/ga-google-analytics/reviews/?rate=5#new-post">';
$text .= __('★★★★★ rating&nbsp;&raquo;', 'ga-google-analytics') .'</a>';
}
return $text;
}
function screen_id() {
if (!function_exists('get_current_screen')) require_once ABSPATH .'/wp-admin/includes/screen.php';
$screen = get_current_screen();
if ($screen && property_exists($screen, 'id')) return $screen->id;
return false;
}
function check_gap_pro() {
if (class_exists('GA_Google_Analytics_Pro')) {
if (is_plugin_active(GAP_FILE)) {
deactivate_plugins(GAP_FILE);
$msg = '<strong>'. esc_html__('Warning:', 'ga-google-analytics') .'</strong> '. esc_html__('Pro version of GA Google Analytics currently active. Free and Pro versions cannot be activated at the same time. ', 'ga-google-analytics');
$msg .= esc_html__('Please return to the', 'ga-google-analytics') .' <a href="'. admin_url('plugins.php') .'">'. esc_html__('WP Admin Area', 'ga-google-analytics') .'</a> '. esc_html__('and try again.', 'ga-google-analytics');
wp_die($msg);
}
}
}
function check_version() {
$wp_version = get_bloginfo('version');
if (isset($_GET['activate']) && $_GET['activate'] == 'true') {
if (version_compare($wp_version, GAP_REQUIRE, '<')) {
if (is_plugin_active(GAP_FILE)) {
deactivate_plugins(GAP_FILE);
$msg = '<strong>'. GAP_NAME .'</strong> '. esc_html__('requires WordPress ', 'ga-google-analytics') . GAP_REQUIRE;
$msg .= esc_html__(' or higher, and has been deactivated. ', 'ga-google-analytics');
$msg .= esc_html__('Please return to the', 'ga-google-analytics') .' <a href="'. admin_url('plugins.php') .'">';
$msg .= esc_html__('WordPress Admin Area', 'ga-google-analytics') .'</a> '. esc_html__('to upgrade WordPress and try again.', 'ga-google-analytics');
wp_die($msg);
}
}
}
}
function load_i18n() {
$domain = 'ga-google-analytics';
$locale = apply_filters('gap_locale', get_locale(), $domain);
$dir = trailingslashit(WP_LANG_DIR);
$file = $domain .'-'. $locale .'.mo';
$path_1 = $dir . $file;
$path_2 = $dir . $domain .'/'. $file;
$path_3 = $dir .'plugins/'. $file;
$path_4 = $dir .'plugins/'. $domain .'/'. $file;
$paths = array($path_1, $path_2, $path_3, $path_4);
foreach ($paths as $path) {
if ($loaded = load_textdomain($domain, $path)) {
return $loaded;
} else {
return load_plugin_textdomain($domain, false, dirname(GAP_FILE) .'/languages/');
}
}
}
function admin_notices() {
$screen_id = $this->screen_id();
if ($screen_id === 'settings_page_ga-google-analytics') {
if (isset($_GET['gap-reset-options'])) {
if ($_GET['gap-reset-options'] === 'true') : ?>
<div class="notice notice-success is-dismissible"><p><strong><?php esc_html_e('Default options restored.', 'ga-google-analytics'); ?></strong></p></div>
<?php else : ?>
<div class="notice notice-info is-dismissible"><p><strong><?php esc_html_e('No changes made to options.', 'ga-google-analytics'); ?></strong></p></div>
<?php endif;
}
if (!$this->check_date_expired() && !$this->dismiss_notice_check()) {
?>
<div class="notice notice-success notice-lh">
<p>
<strong><?php esc_html_e('🚀 SAVE 50% on GA Pro!', 'ga-google-analytics'); ?></strong>
<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/ga-google-analytics-pro/"><?php esc_html_e('Level up with visitor opt-out and multiple tracking codes', 'ga-google-analytics'); ?></a>.
<?php esc_html_e('Apply code', 'ga-google-analytics'); ?> <code>GA50</code> <?php esc_html_e('at checkout. Sale ends 6/28/2026.', 'ga-google-analytics'); ?>
<?php echo $this->dismiss_notice_link(); ?>
</p>
</div>
<?php
}
}
}
//
function dismiss_notice_activate() {
delete_option('ga-google-analytics-dismiss-notice');
}
function dismiss_notice_version() {
$version_current = GAP_VERSION;
$version_previous = get_option('ga-google-analytics-dismiss-notice');
$version_previous = ($version_previous) ? $version_previous : $version_current;
if (version_compare($version_current, $version_previous, '>')) {
delete_option('ga-google-analytics-dismiss-notice');
}
}
function dismiss_notice_check() {
$check = get_option('ga-google-analytics-dismiss-notice');
return ($check) ? true : false;
}
function dismiss_notice_save() {
if (isset($_GET['dismiss-notice-verify']) && wp_verify_nonce($_GET['dismiss-notice-verify'], 'ga_google_analytics_dismiss_notice')) {
if (!current_user_can('manage_options')) exit;
$result = update_option('ga-google-analytics-dismiss-notice', GAP_VERSION, false);
$result = $result ? 'true' : 'false';
$location = admin_url('options-general.php?page=ga-google-analytics&dismiss-notice='. $result);
wp_redirect($location);
exit;
}
}
function dismiss_notice_link() {
$nonce = wp_create_nonce('ga_google_analytics_dismiss_notice');
$href = add_query_arg(array('dismiss-notice-verify' => $nonce), admin_url('options-general.php?page=ga-google-analytics'));
$label = esc_html__('Dismiss', 'ga-google-analytics');
return '<a class="gap-dismiss-notice" href="'. esc_url($href) .'">'. esc_html($label) .'</a>';
}
function check_date_expired() {
$expires = apply_filters('ga_google_analytics_check_date_expired', '2026-06-28');
return (new DateTime() > new DateTime($expires)) ? true : false;
}
//
function reset_options() {
if (isset($_GET['gap-reset-options']) && wp_verify_nonce($_GET['gap-reset-options'], 'gap_reset_options')) {
if (!current_user_can('manage_options')) exit;
$dismiss = delete_option('ga-google-analytics-dismiss-notice');
$update = update_option('gap_options', $this->default_options());
$result = ($dismiss || $update) ? 'true' : 'false';
$location = add_query_arg(array('gap-reset-options' => $result), admin_url(GAP_PATH));
wp_redirect(esc_url_raw($location));
exit;
}
}
function __clone() {
_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&rsquo; huh?', 'ga-google-analytics'), GAP_VERSION);
}
function __wakeup() {
_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&rsquo; huh?', 'ga-google-analytics'), GAP_VERSION);
}
function default_options() {
$options = array(
'gap_id' => '',
'gap_location' => 'header',
'gap_enable' => 2,
'gap_display_ads' => 0,
'link_attr' => 0,
'gap_anonymize' => 0,
'gap_force_ssl' => 0,
'admin_area' => 0,
'disable_admin' => 0,
'gap_custom_loc' => 0,
'tracker_object' => '',
'gap_custom_code' => '',
'gap_custom' => '',
//
'gap_universal' => 1,
'version_alert' => 0,
'default_options' => 0
);
return apply_filters('gap_default_options', $options);
}
function validate_settings($input) {
$input['gap_id'] = wp_filter_nohtml_kses($input['gap_id']);
if (isset($input['gap_id']) && preg_match("/^GTM-/i", $input['gap_id'])) {
$input['gap_id'] = '';
$message = esc_html__('Error: your tracking code begins with', 'ga-google-analytics') .' <code>GTM-</code> ';
$message .= esc_html__('(for Google Tag Manager), which is not supported. Please try again with a supported tracking code.', 'ga-google-analytics');
add_settings_error('gap_id', 'invalid-tracking-code', $message, 'error');
}
if (!isset($input['gap_location'])) $input['gap_location'] = null;
if (!array_key_exists($input['gap_location'], $this->options_locations())) $input['gap_location'] = null;
if (!isset($input['gap_enable'])) $input['gap_enable'] = null;
if (!array_key_exists($input['gap_enable'], $this->options_libraries())) $input['gap_enable'] = null;
if (!isset($input['gap_display_ads'])) $input['gap_display_ads'] = null;
$input['gap_display_ads'] = ($input['gap_display_ads'] == 1 ? 1 : 0);
if (!isset($input['link_attr'])) $input['link_attr'] = null;
$input['link_attr'] = ($input['link_attr'] == 1 ? 1 : 0);
if (!isset($input['gap_anonymize'])) $input['gap_anonymize'] = null;
$input['gap_anonymize'] = ($input['gap_anonymize'] == 1 ? 1 : 0);
if (!isset($input['gap_force_ssl'])) $input['gap_force_ssl'] = null;
$input['gap_force_ssl'] = ($input['gap_force_ssl'] == 1 ? 1 : 0);
if (!isset($input['admin_area'])) $input['admin_area'] = null;
$input['admin_area'] = ($input['admin_area'] == 1 ? 1 : 0);
if (!isset($input['disable_admin'])) $input['disable_admin'] = null;
$input['disable_admin'] = ($input['disable_admin'] == 1 ? 1 : 0);
if (!isset($input['gap_custom_loc'])) $input['gap_custom_loc'] = null;
$input['gap_custom_loc'] = ($input['gap_custom_loc'] == 1 ? 1 : 0);
if (isset($input['tracker_object'])) $input['tracker_object'] = wp_strip_all_tags(trim($input['tracker_object']));
if (isset($input['gap_custom_code'])) $input['gap_custom_code'] = wp_strip_all_tags(trim($input['gap_custom_code']));
if (isset($input['gap_custom'])) {
if ((defined('DISALLOW_UNFILTERED_HTML') && DISALLOW_UNFILTERED_HTML) || is_multisite()) {
$input['gap_custom'] = null;
} else {
$input['gap_custom'] = stripslashes($input['gap_custom']);
}
}
return $input;
}
function options_locations() {
$label_header = esc_html__('Include tracking code in page head', 'ga-google-analytics') .' <span class="gap-note">'. esc_html__('(via', 'ga-google-analytics');
$label_header .= ' <span class="gap-code">wp_head</span>'. esc_html__(')', 'ga-google-analytics') .'</span>';
$label_footer = esc_html__('Include tracking code in page footer', 'ga-google-analytics') .' <span class="gap-note">'. esc_html__('(via', 'ga-google-analytics');
$label_footer .= ' <span class="gap-code">wp_footer</span>'. esc_html__(')', 'ga-google-analytics') .'</span>';
return array(
'header' => array(
'value' => 'header',
'label' => $label_header
),
'footer' => array(
'value' => 'footer',
'label' => $label_footer
)
);
}
function options_libraries() {
// do not change numeric keys or values (order only)
return array(
2 => array(
'value' => 2,
'label' => '<a target="_blank" rel="noopener noreferrer" href="https://support.google.com/analytics/answer/10089681">'. esc_html__('GA4', 'ga-google-analytics') .'</a> <span class="gap-note"> / '. esc_html__('Google Analytics 4 (default)', 'ga-google-analytics') .'</span>',
),
1 => array(
'value' => 1,
'label' => esc_html__('Universal Analytics', 'ga-google-analytics') .' <span class="gap-note">('. esc_html__('deprecated', 'ga-google-analytics') .')</span>',
),
3 => array(
'value' => 3,
'label' => esc_html__('Legacy Tracking', 'ga-google-analytics') .' <span class="gap-note">('. esc_html__('deprecated', 'ga-google-analytics') .')</span>'
)
);
}
function display_settings() {
$gap_options = get_option('gap_options', $this->default_options());
require_once GAP_DIR .'inc/settings-display.php';
}
function select_menu($items, $menu) {
$options = get_option('gap_options', $this->default_options());
$universal = isset($options['gap_universal']) ? $options['gap_universal'] : 1;
$tracking = isset($options['gap_enable']) ? $options['gap_enable'] : 1;
$checked = '';
$output = '';
$class = '';
foreach ($items as $item) {
$key = isset($options[$menu]) ? $options[$menu] : '';
$value = isset($item['value']) ? $item['value'] : '';
if ($menu === 'gap_enable') {
if ($tracking == 0) $key = 1;
if (!$universal && $tracking == 1) $key = 3;
$class = ' gap-select-method';
}
$checked = ($value == $key) ? ' checked="checked"' : '';
$output .= '<div class="gap-radio-inputs'. esc_attr($class) .'">';
$output .= '<input type="radio" name="gap_options['. esc_attr($menu) .']" value="'. esc_attr($item['value']) .'"'. $checked .'> ';
$output .= '<span>'. $item['label'] .'</span>'; //
$output .= '</div>';
}
return $output;
}
function callback_reset() {
$nonce = wp_create_nonce('gap_reset_options');
$href = add_query_arg(array('gap-reset-options' => $nonce), admin_url(GAP_PATH));
$label = esc_html__('Restore default plugin options', 'ga-google-analytics');
return '<a class="gap-reset-options" href="'. esc_url($href) .'">'. esc_html($label) .'</a>';
}
}
$GLOBALS['GA_Google_Analytics'] = $GA_Google_Analytics = new GA_Google_Analytics();
ga_google_analytics_init($GA_Google_Analytics);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -0,0 +1,274 @@
<?php // Google Analytics - Core Functions
if (!function_exists('add_action')) die();
function ga_google_analytics_init($GA_Google_Analytics) {
$options = get_option('gap_options', $GA_Google_Analytics->default_options());
$location = isset($options['gap_location']) ? $options['gap_location'] : 'header';
$admin = isset($options['admin_area']) ? $options['admin_area'] : 0;
$function = 'ga_google_analytics_tracking_code';
if ($location === 'header') {
if ($admin) add_action('admin_head', $function);
add_action('wp_head', $function);
} else {
if ($admin) add_action('admin_footer', $function);
add_action('wp_footer', $function);
}
}
function ga_google_analytics_tracking_code() {
extract(ga_google_analytics_options());
if (empty($tracking_id)) {
echo $custom;
return;
}
if (empty($tracking_method)) return;
if (current_user_can('administrator') && $disable_admin) return;
if ($custom && $custom_location) echo $custom . "\n";
if ($tracking_method == 3) {
ga_google_analytics_legacy($options);
} elseif ($tracking_method == 2) {
ga_google_analytics_global($options);
} else {
if ($universal) {
ga_google_analytics_universal($options);
} else {
ga_google_analytics_legacy($options);
}
}
if ($custom && !$custom_location) echo $custom . "\n";
}
function ga_google_analytics_credit() {
return '<!-- GA Google Analytics @ https://m0n.co/ga -->' ."\n";
}
function ga_google_analytics_universal() {
extract(ga_google_analytics_options());
$custom_code = ga_google_analytics_custom_code($custom_code);
$tracker_object = apply_filters('ga_google_analytics_tracker_object_universal', $tracker_object);
$auto = apply_filters('ga_google_analytics_enable_auto', true) ? ", 'auto'" : "";
$ga_display = "ga('require', 'displayfeatures');";
$ga_link = "ga('require', 'linkid');";
$ga_anon = "ga('set', 'anonymizeIp', true);";
$ga_ssl = "ga('set', 'forceSSL', true);";
$script_atts = apply_filters('ga_google_analytics_script_atts', '');
?>
<?php echo ga_google_analytics_credit(); ?>
<script<?php echo esc_attr($script_atts); ?>>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '<?php echo $tracking_id; ?>'<?php echo $auto; if ($tracker_object) echo ', '. stripslashes(rtrim($tracker_object)); ?>);
<?php
if ($custom_code) echo $custom_code . "\n\t\t\t";
if ($display_ads) echo $ga_display . "\n\t\t\t";
if ($link_attr) echo $ga_link . "\n\t\t\t";
if ($anonymize) echo $ga_anon . "\n\t\t\t";
if ($force_ssl) echo $ga_ssl . "\n\t\t\t";
?>ga('send', 'pageview');
</script>
<?php
}
function ga_google_analytics_global() {
extract(ga_google_analytics_options());
$custom_code = ga_google_analytics_custom_code($custom_code);
$tracker_object = apply_filters('ga_google_analytics_tracker_object_global', $tracker_object);
$script_atts_ext = apply_filters('ga_google_analytics_script_atts_ext', ' async');
$script_atts = apply_filters('ga_google_analytics_script_atts', '');
?>
<?php echo ga_google_analytics_credit(); ?>
<script<?php echo esc_attr($script_atts_ext); ?> src="https://www.googletagmanager.com/gtag/js?id=<?php echo $tracking_id; ?>"></script>
<script<?php echo esc_attr($script_atts); ?>>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
<?php if ($custom_code) echo $custom_code . "\n\t\t\t";
?>gtag('config', '<?php echo $tracking_id; ?>'<?php if ($tracker_object) echo ', '. stripslashes(rtrim($tracker_object)); ?>);
</script>
<?php
}
function ga_google_analytics_legacy() {
extract(ga_google_analytics_options());
$custom_code = ga_google_analytics_custom_code($custom_code);
$ga_alt = "('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';";
$ga_src = "('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';";
$ga_link = "var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js';\n\t\t\t_gaq.push(['_require', 'inpage_linkid', pluginUrl]);";
$ga_anon = "_gaq.push(['_gat._anonymizeIp']);";
$ga_ssl = "_gaq.push(['_gat._forceSSL']);";
if ($display_ads) $ga_src = $ga_alt;
$script_atts = apply_filters('ga_google_analytics_script_atts', '');
?>
<?php echo ga_google_analytics_credit(); ?>
<script<?php echo esc_attr($script_atts); ?> type="text/javascript">
var _gaq = _gaq || [];
<?php
if ($link_attr) echo $ga_link . "\n\t\t\t";
if ($anonymize) echo $ga_anon . "\n\t\t\t";
if ($force_ssl) echo $ga_ssl . "\n\t\t\t";
if ($custom_code) echo $custom_code . "\n\t\t\t";
?>_gaq.push(['_setAccount', '<?php echo $tracking_id; ?>']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = <?php echo $ga_src . "\n"; ?>
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<?php
}
function ga_google_analytics_custom_code($custom_code) {
$custom_code_array = explode(PHP_EOL, $custom_code);
$custom_code = '';
$current_user = wp_get_current_user();
$current_id = $current_user ? $current_user->ID : '';
$current_id = (empty($current_id)) ? '' : $current_id;
$current_name = $current_user ? $current_user->user_login : '';
foreach ($custom_code_array as $code) {
$code = preg_replace("/%%userid%%/i", $current_id, $code);
$code = preg_replace("/%%username%%/i", $current_name, $code);
$custom_code .= "\t\t\t" . rtrim($code) . "\n";
}
$custom_code = stripslashes(trim($custom_code));
return apply_filters('gap_custom_code', $custom_code);
}
function ga_google_analytics_options() {
global $GA_Google_Analytics;
$options = get_option('gap_options', $GA_Google_Analytics->default_options());
$tracking_id = (isset($options['gap_id']) && !empty($options['gap_id'])) ? $options['gap_id'] : '';
$location = isset($options['gap_location']) ? $options['gap_location'] : 'header';
$tracking_method = isset($options['gap_enable']) ? $options['gap_enable'] : 1;
$universal = isset($options['gap_universal']) ? $options['gap_universal'] : 1;
$display_ads = isset($options['gap_display_ads']) ? $options['gap_display_ads'] : 0;
$link_attr = isset($options['link_attr']) ? $options['link_attr'] : 0;
$anonymize = isset($options['gap_anonymize']) ? $options['gap_anonymize'] : 0;
$force_ssl = isset($options['gap_force_ssl']) ? $options['gap_force_ssl'] : 0;
$admin_area = isset($options['admin_area']) ? $options['admin_area'] : 0;
$disable_admin = isset($options['disable_admin']) ? $options['disable_admin'] : 0;
$custom_location = isset($options['gap_custom_loc']) ? $options['gap_custom_loc'] : 0;
$tracker_object = isset($options['tracker_object']) ? $options['tracker_object'] : '';
$custom_code = isset($options['gap_custom_code']) ? $options['gap_custom_code'] : '';
$custom = isset($options['gap_custom']) ? $options['gap_custom'] : '';
// $options, $tracking_id, $location, $tracking_method, $universal, $display_ads, $link_attr, $anonymize,
// $force_ssl, $admin_area, $disable_admin, $custom_location, $tracker_object, $custom_code, $custom
$options_array = array(
'options' => $options,
'tracking_id' => $tracking_id,
'location' => $location,
'tracking_method' => $tracking_method,
'universal' => $universal,
'display_ads' => $display_ads,
'link_attr' => $link_attr,
'anonymize' => $anonymize,
'force_ssl' => $force_ssl,
'admin_area' => $admin_area,
'disable_admin' => $disable_admin,
'custom_location' => $custom_location,
'tracker_object' => $tracker_object,
'custom_code' => $custom_code,
'custom' => $custom
);
return apply_filters('ga_google_analytics_options_array', $options_array);
}

View File

@@ -0,0 +1,287 @@
<?php // Google Analytics - Settings Display
if (!function_exists('add_action')) die(); ?>
<div class="wrap">
<h1><?php echo GAP_NAME; ?> <small><?php echo 'v'. GAP_VERSION; ?></small></h1>
<div class="gap-toggle-all"><a href="<?php echo admin_url(GAP_PATH); ?>"><?php esc_html_e('Toggle all panels', 'ga-google-analytics'); ?></a></div>
<form method="post" action="options.php">
<?php settings_fields('gap_plugin_options'); ?>
<div class="metabox-holder">
<div class="meta-box-sortables ui-sortable">
<div id="gap-panel-overview" class="postbox">
<h2><?php esc_html_e('Overview', 'ga-google-analytics'); ?></h2>
<div class="toggle<?php if (isset($_GET['settings-updated'])) echo ' default-hidden'; ?>">
<div class="gap-panel-overview">
<div class="gap-col-1">
<p>
<?php esc_html_e('This plugin adds the', 'ga-google-analytics'); ?>
<abbr title="<?php esc_attr_e('Google Analytics', 'ga-google-analytics'); ?>"><?php esc_html_e('GA', 'ga-google-analytics'); ?></abbr>
<?php esc_html_e('tracking snippet to your site. Log in to your Google account to view your stats.', 'ga-google-analytics'); ?>
</p>
<ul>
<li><a class="gap-toggle" data-target="usage" href="#gap-panel-usage"><?php esc_html_e('How to Use', 'ga-google-analytics'); ?></a></li>
<li><a class="gap-toggle" data-target="settings" href="#gap-panel-settings"><?php esc_html_e('Plugin Settings', 'ga-google-analytics'); ?></a></li>
<li><a target="_blank" rel="noopener noreferrer" href="https://wordpress.org/plugins/ga-google-analytics/"><?php esc_html_e('Plugin Homepage', 'ga-google-analytics'); ?></a></li>
</ul>
<p>
<?php esc_html_e('If you like this plugin, please', 'ga-google-analytics'); ?>
<a target="_blank" rel="noopener noreferrer" href="https://wordpress.org/support/plugin/ga-google-analytics/reviews/?rate=5#new-post" title="<?php esc_attr_e('THANK YOU for your support!', 'ga-google-analytics'); ?>">
<?php esc_html_e('give it a 5-star rating', 'ga-google-analytics'); ?>&nbsp;&raquo;
</a>
</p>
</div>
<div class="gap-col-2">
<p>
🔥 <?php esc_html_e('Check out the', 'ga-google-analytics'); ?>
<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/ga-google-analytics-pro/" title="<?php esc_html_e('GA Google Analytics Pro', 'ga-google-analytics'); ?>"><?php esc_html_e('PRO Version', 'ga-google-analytics'); ?>&nbsp;&raquo;</a>
</p>
</div>
</div>
</div>
</div>
<div id="gap-panel-usage" class="postbox">
<h2><?php esc_html_e('How to Use', 'ga-google-analytics'); ?></h2>
<div class="toggle default-hidden">
<div class="gap-panel-usage">
<p><strong><?php esc_html_e('How to add Google Analytics 4 to your site:', 'ga-google-analytics'); ?></strong></p>
<ol>
<li><?php esc_html_e('Follow', 'ga-google-analytics'); ?> <a target="_blank" rel="noopener noreferrer" href="https://support.google.com/analytics/answer/9304153"><?php esc_html_e('this guide', 'ga-google-analytics'); ?></a> <?php esc_html_e('to create your GA account', 'ga-google-analytics'); ?></li>
<li><?php esc_html_e('During account creation, you&rsquo;ll get a tracking (measurement) ID', 'ga-google-analytics'); ?></li>
<li><?php esc_html_e('Toggle open the "Plugin Settings" panel on this page (below)', 'ga-google-analytics'); ?></li>
<li><?php esc_html_e('Add your Google tracking (measurement) ID to the plugin setting, "GA Tracking ID"', 'ga-google-analytics'); ?></li>
<li><?php esc_html_e('Select "GA4" for the plugin setting, "Tracking Method"', 'ga-google-analytics'); ?></li>
<li><?php esc_html_e('Configure any other plugin settings as desired (optional)', 'ga-google-analytics'); ?></li>
</ol>
<p><?php esc_html_e('Save changes and done. After 24-48 hours, you can log into your Google Analytics account to view your stats.', 'ga-google-analytics'); ?></p>
<div class="gap-caption">
<?php esc_html_e('Note that it can take 24-48 hours after adding the tracking code before any analytical data appears in your', 'ga-google-analytics'); ?>
<a target="_blank" rel="noopener noreferrer" href="https://www.google.com/analytics/"><?php esc_html_e('Google Analytics account', 'ga-google-analytics'); ?></a>.
<?php esc_html_e('To check that the GA tacking code is included properly, examine the source code of your web pages. Learn more at the', 'ga-google-analytics'); ?>
<a target="_blank" rel="noopener noreferrer" href="https://support.google.com/analytics/"><?php esc_html_e('Google Analytics Help Center', 'ga-google-analytics'); ?></a>.
</div>
</div>
</div>
</div>
<div id="gap-panel-settings" class="postbox">
<h2><?php esc_html_e('Plugin Settings', 'ga-google-analytics'); ?></h2>
<div class="toggle<?php if (!isset($_GET['settings-updated'])) echo ' default-hidden'; ?>">
<div class="gap-panel-settings">
<table class="widefat">
<tr>
<th><label for="gap_options[gap_id]"><?php esc_html_e('GA Tracking ID', 'ga-google-analytics') ?></label></th>
<td>
<input id="gap_options[gap_id]" name="gap_options[gap_id]" type="text" size="30" maxlength="30" value="<?php if (isset($gap_options['gap_id'])) echo esc_attr($gap_options['gap_id']); ?>">
<div class="gap-caption">
<?php esc_html_e('Enter your Google Tracking ID.', 'ga-google-analytics'); ?>
<a class="toggle-link" href="#more-info"><?php esc_html_e('Show info', 'ga-google-analytics'); ?></a>
<span class="toggle-data"> <?php esc_html_e('Note: the Tracking ID also may be referred to as Tag ID, Measurement ID, or Property ID. Supported ID formats include AW-XXXXXXXXX, G-XXXXXXXXX, GT-XXXXXXXXX, and UA-XXXXXXXXX. Google Tag Manager (GTM-XXXXXXXXX) currently is not supported.', 'ga-google-analytics'); ?></span>
</div>
</td>
</tr>
<tr>
<th><label for="gap_options[gap_enable]"><?php esc_html_e('Tracking Method', 'ga-google-analytics') ?></label></th>
<td><?php echo $this->select_menu($this->options_libraries(), 'gap_enable'); ?></td>
</tr>
</table>
<div class="gap-info-universal<?php if (isset($gap_options['gap_enable']) && $gap_options['gap_enable'] == 2) echo ' default-hidden'; ?>">
<table class="widefat">
<tr>
<th><label for="gap_options[gap_display_ads]"><?php esc_html_e('Display Advertising', 'ga-google-analytics') ?></label></th>
<td>
<input id="gap_options[gap_display_ads]" name="gap_options[gap_display_ads]" type="checkbox" value="1" <?php if (isset($gap_options['gap_display_ads'])) checked('1', $gap_options['gap_display_ads']); ?>>
<?php esc_html_e('Enable support for', 'ga-google-analytics'); ?>
<a target="_blank" rel="noopener noreferrer" href="https://support.google.com/analytics/answer/2444872"><?php esc_html_e('Display Advertising', 'ga-google-analytics'); ?></a>
</td>
</tr>
<tr>
<th><label for="gap_options[link_attr]"><?php esc_html_e('Link Attribution', 'ga-google-analytics') ?></label></th>
<td>
<input id="gap_options[link_attr]" name="gap_options[link_attr]" type="checkbox" value="1" <?php if (isset($gap_options['link_attr'])) checked('1', $gap_options['link_attr']); ?>>
<?php esc_html_e('Enable support for', 'ga-google-analytics'); ?>
<a target="_blank" rel="noopener noreferrer" href="https://support.google.com/analytics/answer/7377126"><?php esc_html_e('Enhanced Link Attribution', 'ga-google-analytics'); ?></a>
</td>
</tr>
<tr>
<th><label for="gap_options[gap_anonymize]"><?php esc_html_e('IP Anonymization', 'ga-google-analytics') ?></label></th>
<td>
<input id="gap_options[gap_anonymize]" name="gap_options[gap_anonymize]" type="checkbox" value="1" <?php if (isset($gap_options['gap_anonymize'])) checked('1', $gap_options['gap_anonymize']); ?>>
<?php esc_html_e('Enable support for', 'ga-google-analytics'); ?>
<a target="_blank" rel="noopener noreferrer" href="https://support.google.com/analytics/answer/2763052"><?php esc_html_e('IP Anonymization', 'ga-google-analytics'); ?></a>
</td>
</tr>
<tr>
<th><label for="gap_options[gap_force_ssl]"><?php esc_html_e('Force SSL', 'ga-google-analytics') ?></label></th>
<td>
<input id="gap_options[gap_force_ssl]" name="gap_options[gap_force_ssl]" type="checkbox" value="1" <?php if (isset($gap_options['gap_force_ssl'])) checked('1', $gap_options['gap_force_ssl']); ?>>
<?php esc_html_e('Enable support for Force SSL', 'ga-google-analytics'); ?>
</td>
</tr>
</table>
</div>
<table class="widefat">
<tr>
<th><label for="gap_options[gap_location]"><?php esc_html_e('Tracking Code Location', 'ga-google-analytics'); ?></label></th>
<td>
<?php echo $this->select_menu($this->options_locations(), 'gap_location'); ?>
<div class="gap-caption">
<?php esc_html_e('Tip: Google recommends including the tracking code in the page head, but including it in the footer can benefit page performance.', 'ga-google-analytics'); ?>
<?php esc_html_e('If in doubt, go with the head option.', 'ga-google-analytics'); ?>
</div>
</td>
</tr>
<tr>
<th><label for="gap_options[tracker_object]"><?php esc_html_e('Custom Tracker Objects', 'ga-google-analytics'); ?></label></th>
<td>
<textarea id="gap_options[tracker_object]" name="gap_options[tracker_object]" type="textarea" rows="4" cols="70"><?php if (isset($gap_options['tracker_object'])) echo esc_textarea($gap_options['tracker_object']); ?></textarea>
<div class="gap-caption">
<?php esc_html_e('Optional code added to', 'ga-google-analytics'); ?> <span class="gap-code">gtag('config')</span>
<?php esc_html_e('for GA4, or added to', 'ga-google-analytics'); ?> <span class="gap-code">ga('create')</span>
<?php esc_html_e('for Universal Analytics.', 'ga-google-analytics'); ?>
</div>
</td>
</tr>
<tr>
<th><label for="gap_options[gap_custom_code]"><?php esc_html_e('Custom GA Code', 'ga-google-analytics'); ?></label></th>
<td>
<textarea id="gap_options[gap_custom_code]" name="gap_options[gap_custom_code]" type="textarea" rows="4" cols="70"><?php if (isset($gap_options['gap_custom_code'])) echo esc_textarea($gap_options['gap_custom_code']); ?></textarea>
<div class="gap-caption">
<?php esc_html_e('Optional code added to the GA tracking snippet. This is useful for things like creating multiple trackers and user opt-out. Note: you can use', 'ga-google-analytics'); ?>
<span class="gap-code">%%userid%%</span> <?php esc_html_e('and', 'ga-google-analytics'); ?> <span class="gap-code">%%username%%</span>
<?php esc_html_e('to get the current user ID and login name.', 'ga-google-analytics'); ?>
</div>
</td>
</tr>
<tr>
<th><label for="gap_options[gap_custom]"><?php esc_html_e('Custom Code', 'ga-google-analytics'); ?></label></th>
<td>
<textarea id="gap_options[gap_custom]" name="gap_options[gap_custom]" type="textarea" rows="4" cols="70"><?php if (isset($gap_options['gap_custom'])) echo esc_textarea($gap_options['gap_custom']); ?></textarea>
<div class="gap-caption">
<?php esc_html_e('Optional markup added to', 'ga-google-analytics'); ?> <span class="gap-code">&lt;head&gt;</span>
<?php esc_html_e('or footer, depending on the previous setting, Tracking Code Location.', 'ga-google-analytics'); ?>
</div>
</td>
</tr>
<tr>
<th><label for="gap_options[gap_custom_loc]"><?php esc_html_e('Custom Code Location', 'ga-google-analytics'); ?></label></th>
<td>
<input id="gap_options[gap_custom_loc]" name="gap_options[gap_custom_loc]" type="checkbox" value="1" <?php if (isset($gap_options['gap_custom_loc'])) checked('1', $gap_options['gap_custom_loc']); ?>>
<?php esc_html_e('Display Custom Code', 'ga-google-analytics'); ?> <em><?php esc_html_e('before', 'ga-google-analytics'); ?></em>
<?php esc_html_e('the GA tracking code (leave unchecked to display', 'ga-google-analytics'); ?> <em><?php esc_html_e('after', 'ga-google-analytics'); ?></em> <?php esc_html_e('the tracking code)', 'ga-google-analytics'); ?>
</td>
</tr>
<tr>
<th><label for="gap_options[admin_area]"><?php esc_html_e('Admin Area', 'ga-google-analytics') ?></label></th>
<td>
<input id="gap_options[admin_area]" name="gap_options[admin_area]" type="checkbox" value="1" <?php if (isset($gap_options['admin_area'])) checked('1', $gap_options['admin_area']); ?>>
<?php esc_html_e('Enable tracking in WP Admin Area (adds tracking code only; to view stats log into your Google account)', 'ga-google-analytics'); ?>
</td>
</tr>
<tr>
<th><label for="gap_options[disable_admin]"><?php esc_html_e('Admin Users', 'ga-google-analytics') ?></label></th>
<td>
<input id="gap_options[disable_admin]" name="gap_options[disable_admin]" type="checkbox" value="1" <?php if (isset($gap_options['disable_admin'])) checked('1', $gap_options['disable_admin']); ?>>
<?php esc_html_e('Disable tracking of Admin-level users', 'ga-google-analytics') ?>
</td>
</tr>
<tr>
<th><label><?php esc_html_e('More Options', 'ga-google-analytics') ?></label></th>
<td class="ga-pro-info">
<?php esc_html_e('For advanced features, check out', 'ga-google-analytics') ?>
<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/ga-google-analytics-pro/"><?php esc_html_e('GA Google Analytics Pro', 'ga-google-analytics'); ?>&nbsp;&raquo;</a>
</td>
</tr>
</table>
</div>
<input type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes', 'ga-google-analytics'); ?>" />
</div>
</div>
<div id="gap-panel-restore" class="postbox">
<h2><?php esc_html_e('Restore Defaults', 'ga-google-analytics'); ?></h2>
<div class="toggle default-hidden">
<p><?php esc_html_e('Click the link to restore the default plugin options.', 'ga-google-analytics'); ?></p>
<p><?php echo $this->callback_reset(); ?></p>
</div>
</div>
<div id="gap-panel-current" class="postbox">
<h2><?php esc_html_e('WP Resources', 'ga-google-analytics'); ?></h2>
<div class="toggle<?php if (isset($_GET['settings-updated'])) echo ' default-hidden'; ?>">
<?php require_once GAP_DIR .'inc/support-panel.php'; ?>
</div>
</div>
</div>
</div>
<div class="gap-credit-info">
<a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url(GAP_HOME); ?>" title="<?php esc_attr_e('Plugin Homepage', 'ga-google-analytics'); ?>"><?php echo GAP_NAME; ?></a>
<?php esc_attr_e('by', 'ga-google-analytics'); ?>
<a target="_blank" rel="noopener noreferrer" href="https://x.com/perishable" title="<?php esc_attr_e('Jeff Starr on X (Twitter)', 'ga-google-analytics'); ?>">Jeff Starr</a>
<?php esc_attr_e('@', 'ga-google-analytics'); ?>
<a target="_blank" rel="noopener noreferrer" href="https://monzillamedia.com/" title="<?php esc_attr_e('Obsessive Web Development', 'ga-google-analytics'); ?>">Monzilla Media</a>
</div>
</form>
</div>

View File

@@ -0,0 +1,141 @@
<?php // Google Analytics - Show Support Panel
if (!function_exists('add_action')) die();
function ga_google_analytics_wp_resources() {
$plugin_project = esc_html__('Google Analytics', 'ga-google-analytics');
$plugin_url = esc_url(GAP_URL);
$array = array(
0 => '<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/bbq-pro/" title="BBQ Pro: Fastest Firewall for WordPress">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-bbq-pro.jpg" alt="">
</a>',
1 => '<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/banhammer-pro/" title="Banhammer Pro: Monitor Traffic. Hammer the Enemy.">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-banhammer-pro.jpg" alt="">
</a>',
2 => '<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/blackhole-pro/" title="Blackhole Pro: Trap Bad Bots in a Virtual Black Hole">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-blackhole-pro.jpg" alt="">
</a>',
3 => '<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/ga-google-analytics-pro/" title="GA Pro: Connect Google Analytics to WordPress">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-ga-pro.jpg" alt="">
</a>',
4 => '<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/head-meta-pro/" title="Head Meta Pro: Ultimate Meta Tags for WordPress">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-head-meta-pro.jpg" alt="">
</a>',
5 => '<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/simple-ajax-chat-pro/" title="SAC Pro: Own Your Chats">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-sac-pro.jpg" alt="">
</a>',
6 => '<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/usp-pro/" title="USP Pro: Unlimited Front-End Forms">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-usp-pro.jpg" alt="">
</a>',
//
7 => '<a target="_blank" rel="noopener noreferrer" href="https://digwp.com/" title="Take your WordPress Skills to the Next Level">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-digging-into-wordpress.jpg" alt="">
</a>',
8 => '<a target="_blank" rel="noopener noreferrer" href="https://wp-tao.com/" title="Learn the Way of WordPress">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-tao-of-wordpress.jpg" alt="">
</a>',
9 => '<a target="_blank" rel="noopener noreferrer" href="https://wp-tao.com/wordpress-themes-book/" title="WordPress Themes In Depth">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-wp-themes-in-depth.jpg" alt="">
</a>',
10 => '<a target="_blank" rel="noopener noreferrer" href="https://htaccessbook.com/" title="Optimize and Secure with .htaccess">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-htaccess-made-easy.jpg" alt="">
</a>',
11 => '<a target="_blank" rel="noopener noreferrer" href="https://books.perishablepress.com/downloads/wizards-collection-sql-recipes-wordpress/" title="Wizard&rsquo;s SQL Recipes for WordPress">
<img width="125" height="125" src="'. $plugin_url .'img/250x250-wizards-sql.jpg" alt="">
</a>',
);
$items = array_rand($array, 3);
$item1 = isset($array[$items[0]]) ? $array[$items[0]] : 0;
$item2 = isset($array[$items[1]]) ? $array[$items[1]] : 1;
$item3 = isset($array[$items[2]]) ? $array[$items[2]] : 2;
$url1 = esc_url('https://books.perishablepress.com/');
$url2 = esc_url('https://plugin-planet.com/store/');
$url3 = esc_url('https://monzillamedia.com/donate.html');
$title1 = esc_html__('Perishable Press Books', 'ga-google-analytics');
$title2 = esc_html__('Plugin Planet: Pro WordPress Plugins', 'ga-google-analytics');
$title3 = esc_html__('Donate via PayPal, credit card, or cryptocurrency', 'ga-google-analytics');
$link1 = ' <a target="_blank" rel="noopener noreferrer" href="'. $url1 .'" title="'. $title1 .'">'. esc_html__('books', 'ga-google-analytics') .'</a> ';
$link2 = ' <a target="_blank" rel="noopener noreferrer" href="'. $url2 .'" title="'. $title2 .'">'. esc_html__('plugins', 'ga-google-analytics') .'</a>, ';
$link3 = ' <a target="_blank" rel="noopener noreferrer" href="'. $url3 .'" title="'. $title3 .'">'. esc_html__('donation', 'ga-google-analytics') .'</a>. ';
$message = esc_html__('Thank you for using', 'ga-google-analytics') .' '. $plugin_project .'! ';
$message .= esc_html__('Please show support by purchasing one of my', 'ga-google-analytics') . $link1;
$message .= esc_html__('or', 'ga-google-analytics') . $link2 . esc_html__('or by making a', 'ga-google-analytics') . $link3;
$message .= esc_html__('Your generous support helps to ensure future development of', 'ga-google-analytics') .' '. $plugin_project .' ';
$message .= esc_html__('and is greatly appreciated.', 'ga-google-analytics');
$donate = esc_html__('Any size donation helps me to continue developing this free plugin and other awesome WordPress resources.', 'ga-google-analytics');
?>
<style type="text/css">
#project-wrap { width: 100%; overflow: hidden; }
#project-wrap p { margin-top: 5px; font-size: 12px; }
#project-wrap .project-support { float: left; max-width: 480px; }
#project-wrap .project-links { width: 100%; overflow: hidden; margin: 15px 0; }
#project-wrap .project-links img { display: block; width: 125px; height: 125px; margin: 0; padding: 0; border: 0; background-color: #fff; color: #fff; }
#project-wrap .project-links a { float: left; width: 125px; height: 125px; margin: 0 0 0 15px; padding: 1px; border: 1px solid #ccc; opacity: 0.9; }
#project-wrap .project-links a:link, #project-wrap .project-links a:visited, #project-wrap .project-links a:hover, #project-wrap .project-links a:after { box-shadow: none; }
#project-wrap .project-links a:hover { opacity: 1.0; }
#project-wrap .project-blurb {
float: left; width: 220px; box-sizing: border-box; margin: 0 0 25px 20px; padding: 15px 20px; border-radius: 5px;
background-color: #fefefe; border: 1px solid #ccc; box-shadow: 0 20px 25px -20px rgba(0,0,0,0.5);
}
#project-wrap .project-blurb a { text-decoration: none; }
#project-wrap .project-blurb a:hover { text-decoration: underline; }
#project-wrap .project-blurb p { margin-left: 0; margin-right: 0; }
#project-wrap .project-blurb p:first-child { margin: 0 0 10px 0; font-size: 13px; }
#project-wrap .project-blurb ul { margin: 0; padding: 0; font-size: 12px; }
#project-wrap .project-blurb li { margin: 5px 0; list-style: none; }
@media (max-width: 800px) {
#gap-panel-current { display: none; }
}
</style>
<div id="project-wrap">
<div class="project-support">
<div class="project-message">
<p><?php echo $message; ?></p>
</div>
<div class="project-links">
<?php echo $item1 . $item2 . $item3; ?>
</div>
</div>
<div class="project-blurb">
<p><strong><?php esc_html_e('Please Donate', 'ga-google-analytics'); ?></strong></p>
<p><?php echo $donate; ?></p>
<ul>
<li><a target="_blank" rel="noopener noreferrer" href="<?php echo $url3; ?>" title="<?php echo $title3; ?>"><?php esc_html_e('Make a donation&nbsp;&raquo;', 'ga-google-analytics'); ?></a></li>
</ul>
</div>
</div>
<?php
}
ga_google_analytics_wp_resources();

View File

@@ -0,0 +1,30 @@
/* GA Google Analytics */
jQuery(document).ready(function($) {
$('.default-hidden').hide();
$('h2').click(function() { $(this).next().slideToggle(300); });
$('.gap-toggle-all a').click(function(e) { e.preventDefault(); $('.toggle').slideToggle(300); });
$('.gap-toggle').click(function(e) { e.preventDefault(); $('.toggle').slideUp(300); $('#gap-panel-'+ $(this).data('target') +' .toggle').slideDown(300); });
$('.gap-reset-options').click(function() { return confirm(ga_google_analytics.confirm_message); });
$('.gap-select-method:nth-child(2) input, .gap-select-method:nth-child(3) input').click(function() { $('.gap-info-universal').slideDown(300); });
$('.gap-select-method:nth-child(1) input').click(function() { $('.gap-info-universal').slideUp(300); });
$('.toggle-data').css('display', 'none');
$('.toggle-link').on('click', function() {
if ($('.toggle-link').text() === 'Show info') {
$('.toggle-link').text('Hide info');
$('.toggle-data').css('display', 'inline');
} else {
$('.toggle-link').text('Show info');
$('.toggle-data').css('display', 'none');
}
});
});

View File

@@ -0,0 +1,573 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: GA Google Analytics\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-09 15:51+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: \n"
"Language: \n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Loco https://localise.biz/"
#: ga-google-analytics.php:239
msgid " or higher, and has been deactivated! "
msgstr ""
#: ga-google-analytics.php:473
msgid ""
"(for Google Tag Manager), which is not supported. Please try again with a "
"supported tracking code."
msgstr ""
#: ga-google-analytics.php:530 ga-google-analytics.php:533
msgid "(via"
msgstr ""
#: ga-google-analytics.php:531 ga-google-analytics.php:534
msgid ")"
msgstr ""
#: inc/settings-display.php:280
msgid "@"
msgstr ""
#: inc/settings-display.php:79
msgid ""
"Add your Google tracking (measurement) ID to the plugin setting, \"GA "
"Tracking ID\""
msgstr ""
#. Description of the plugin
msgid "Adds your Google Analytics Tracking Code to your WordPress site."
msgstr ""
#: inc/settings-display.php:215
msgid "Admin Area"
msgstr ""
#: inc/settings-display.php:222
msgid "Admin Users"
msgstr ""
#: inc/settings-display.php:211
msgid "after"
msgstr ""
#: inc/settings-display.php:191
msgid "and"
msgstr ""
#: inc/support-panel.php:87
msgid "and is greatly appreciated."
msgstr ""
#: ga-google-analytics.php:216
msgid "and try again."
msgstr ""
#: inc/support-panel.php:89
msgid ""
"Any size donation helps me to continue developing this free plugin and other "
"awesome WordPress resources."
msgstr ""
#: ga-google-analytics.php:317
msgid "Apply code"
msgstr ""
#: ga-google-analytics.php:118
msgid "Are you sure you want to restore all default options?"
msgstr ""
#: ga-google-analytics.php:317
msgid "at checkout. Sale ends 3/28/2026."
msgstr ""
#: inc/settings-display.php:210
msgid "before"
msgstr ""
#: inc/support-panel.php:79
msgid "books"
msgstr ""
#: inc/settings-display.php:278
msgid "by"
msgstr ""
#: ga-google-analytics.php:426 ga-google-analytics.php:432
msgid "Cheatin&rsquo; huh?"
msgstr ""
#: inc/settings-display.php:53
msgid "Check out the"
msgstr ""
#: ga-google-analytics.php:163
msgid "Click here to rate and review this plugin on WordPress.org"
msgstr ""
#: inc/settings-display.php:251
msgid "Click the link to restore the default plugin options."
msgstr ""
#: inc/settings-display.php:81
msgid "Configure any other plugin settings as desired (optional)"
msgstr ""
#: inc/settings-display.php:197
msgid "Custom Code"
msgstr ""
#: inc/settings-display.php:207
msgid "Custom Code Location"
msgstr ""
#: inc/settings-display.php:186
msgid "Custom GA Code"
msgstr ""
#: inc/settings-display.php:175
msgid "Custom Tracker Objects"
msgstr ""
#: ga-google-analytics.php:299
msgid "Default options restored."
msgstr ""
#: ga-google-analytics.php:562 ga-google-analytics.php:566
msgid "deprecated"
msgstr ""
#: inc/settings-display.php:225
msgid "Disable tracking of Admin-level users"
msgstr ""
#: ga-google-analytics.php:388
msgid "Dismiss"
msgstr ""
#: inc/settings-display.php:129 inc/settings-display.php:133
msgid "Display Advertising"
msgstr ""
#: inc/settings-display.php:210
msgid "Display Custom Code"
msgstr ""
#: inc/support-panel.php:77
msgid "Donate via PayPal, credit card, or cryptocurrency"
msgstr ""
#: inc/support-panel.php:81
msgid "donation"
msgstr ""
#: inc/settings-display.php:77
msgid "During account creation, you&rsquo;ll get a tracking (measurement) ID"
msgstr ""
#: inc/settings-display.php:132 inc/settings-display.php:140
#: inc/settings-display.php:148
msgid "Enable support for"
msgstr ""
#: inc/settings-display.php:156
msgid "Enable support for Force SSL"
msgstr ""
#: inc/settings-display.php:218
msgid ""
"Enable tracking in WP Admin Area (adds tracking code only; to view stats log "
"into your Google account)"
msgstr ""
#: inc/settings-display.php:141
msgid "Enhanced Link Attribution"
msgstr ""
#: inc/settings-display.php:113
msgid "Enter your Google Tracking ID."
msgstr ""
#: ga-google-analytics.php:472
msgid "Error: your tracking code begins with"
msgstr ""
#: inc/settings-display.php:76
msgid "Follow"
msgstr ""
#: inc/settings-display.php:231
msgid "For advanced features, check out"
msgstr ""
#: inc/settings-display.php:180
msgid "for GA4, or added to"
msgstr ""
#: inc/settings-display.php:181
msgid "for Universal Analytics."
msgstr ""
#: inc/settings-display.php:153
msgid "Force SSL"
msgstr ""
#: inc/settings-display.php:31
msgid "GA"
msgstr ""
#. Name of the plugin
#: ga-google-analytics.php:88
msgid "GA Google Analytics"
msgstr ""
#: inc/settings-display.php:54 inc/settings-display.php:232
msgid "GA Google Analytics Pro"
msgstr ""
#: inc/settings-display.php:109
msgid "GA Tracking ID"
msgstr ""
#: ga-google-analytics.php:558
msgid "GA4"
msgstr ""
#: ga-google-analytics.php:138
msgid "Get GA Pro!"
msgstr ""
#: inc/settings-display.php:44
msgid "give it a 5-star rating"
msgstr ""
#: ga-google-analytics.php:139
msgid "Go&nbsp;Pro"
msgstr ""
#: ga-google-analytics.php:89 inc/settings-display.php:31
#: inc/support-panel.php:7
msgid "Google Analytics"
msgstr ""
#: ga-google-analytics.php:558
msgid "Google Analytics 4 (default)"
msgstr ""
#: inc/settings-display.php:88
msgid "Google Analytics account"
msgstr ""
#: inc/settings-display.php:90
msgid "Google Analytics Help Center"
msgstr ""
#: ga-google-analytics.php:158
msgid "Homepage"
msgstr ""
#: inc/settings-display.php:73
msgid "How to add Google Analytics 4 to your site:"
msgstr ""
#: inc/settings-display.php:36 inc/settings-display.php:67
msgid "How to Use"
msgstr ""
#. URI of the plugin
msgid "https://perishablepress.com/google-analytics-plugin/"
msgstr ""
#. Author URI of the plugin
msgid "https://plugin-planet.com/"
msgstr ""
#: inc/settings-display.php:170
msgid "If in doubt, go with the head option."
msgstr ""
#: inc/settings-display.php:42
msgid "If you like this plugin, please"
msgstr ""
#: ga-google-analytics.php:533
msgid "Include tracking code in page footer"
msgstr ""
#: ga-google-analytics.php:530
msgid "Include tracking code in page head"
msgstr ""
#: inc/settings-display.php:145 inc/settings-display.php:149
msgid "IP Anonymization"
msgstr ""
#. Author of the plugin
msgid "Jeff Starr"
msgstr ""
#: inc/settings-display.php:279
msgid "Jeff Starr on X (Twitter)"
msgstr ""
#: ga-google-analytics.php:566
msgid "Legacy Tracking"
msgstr ""
#: ga-google-analytics.php:316
msgid "Level up with visitor opt-out and multiple tracking codes"
msgstr ""
#: ga-google-analytics.php:182
msgid "Like this plugin? Give it a"
msgstr ""
#: inc/settings-display.php:137
msgid "Link Attribution"
msgstr ""
#: inc/support-panel.php:132
msgid "Make a donation&nbsp;&raquo;"
msgstr ""
#: inc/settings-display.php:229
msgid "More Options"
msgstr ""
#: ga-google-analytics.php:303
msgid "No changes made to options."
msgstr ""
#: inc/settings-display.php:87
msgid ""
"Note that it can take 24-48 hours after adding the tracking code before any "
"analytical data appears in your"
msgstr ""
#: inc/settings-display.php:115
msgid ""
"Note: the Tracking ID also may be referred to as Tag ID, Measurement ID, or "
"Property ID. Supported ID formats include AW-XXXXXXXXX, G-XXXXXXXXX, GT-"
"XXXXXXXXX, and UA-XXXXXXXXX. Google Tag Manager (GTM-XXXXXXXXX) currently is "
"not supported."
msgstr ""
#: inc/settings-display.php:281
msgid "Obsessive Web Development"
msgstr ""
#: inc/settings-display.php:179
msgid "Optional code added to"
msgstr ""
#: inc/settings-display.php:190
msgid ""
"Optional code added to the GA tracking snippet. This is useful for things "
"like creating multiple trackers and user opt-out. Note: you can use"
msgstr ""
#: inc/settings-display.php:201
msgid "Optional markup added to"
msgstr ""
#: inc/support-panel.php:85
msgid "or"
msgstr ""
#: inc/support-panel.php:85
msgid "or by making a"
msgstr ""
#: inc/settings-display.php:202
msgid "or footer, depending on the previous setting, Tracking Code Location."
msgstr ""
#: inc/settings-display.php:21
msgid "Overview"
msgstr ""
#: inc/support-panel.php:75
msgid "Perishable Press Books"
msgstr ""
#: inc/support-panel.php:129
msgid "Please Donate"
msgstr ""
#: ga-google-analytics.php:216 ga-google-analytics.php:240
msgid "Please return to the"
msgstr ""
#: inc/support-panel.php:84
msgid "Please show support by purchasing one of my"
msgstr ""
#: ga-google-analytics.php:157 inc/settings-display.php:38
#: inc/settings-display.php:277
msgid "Plugin Homepage"
msgstr ""
#: inc/support-panel.php:76
msgid "Plugin Planet: Pro WordPress Plugins"
msgstr ""
#: inc/settings-display.php:37 inc/settings-display.php:101
msgid "Plugin Settings"
msgstr ""
#: inc/support-panel.php:80
msgid "plugins"
msgstr ""
#: inc/settings-display.php:54
msgid "PRO Version"
msgstr ""
#: ga-google-analytics.php:214
msgid ""
"Pro version of GA Google Analytics currently active. Free and Pro versions "
"cannot be activated at the same time. "
msgstr ""
#: ga-google-analytics.php:164
msgid "Rate this plugin"
msgstr ""
#: ga-google-analytics.php:238
msgid "requires WordPress "
msgstr ""
#: ga-google-analytics.php:630
msgid "Restore default plugin options"
msgstr ""
#: inc/settings-display.php:247
msgid "Restore Defaults"
msgstr ""
#: inc/settings-display.php:239
msgid "Save Changes"
msgstr ""
#: inc/settings-display.php:84
msgid ""
"Save changes and done. After 24-48 hours, you can log into your Google "
"Analytics account to view your stats."
msgstr ""
#: inc/settings-display.php:80
msgid "Select \"GA4\" for the plugin setting, \"Tracking Method\""
msgstr ""
#: ga-google-analytics.php:129
msgid "Settings"
msgstr ""
#: inc/settings-display.php:114
msgid "Show info"
msgstr ""
#: inc/support-panel.php:83
msgid "Thank you for using"
msgstr ""
#: inc/settings-display.php:43
msgid "THANK YOU for your support!"
msgstr ""
#: inc/settings-display.php:211
msgid "the GA tracking code (leave unchecked to display"
msgstr ""
#: inc/settings-display.php:211
msgid "the tracking code)"
msgstr ""
#: inc/settings-display.php:76
msgid "this guide"
msgstr ""
#: inc/settings-display.php:30
msgid "This plugin adds the"
msgstr ""
#: inc/settings-display.php:169
msgid ""
"Tip: Google recommends including the tracking code in the page head, but "
"including it in the footer can benefit page performance."
msgstr ""
#: inc/settings-display.php:89
msgid ""
"To check that the GA tacking code is included properly, examine the source "
"code of your web pages. Learn more at the"
msgstr ""
#: inc/settings-display.php:76
msgid "to create your GA account"
msgstr ""
#: inc/settings-display.php:192
msgid "to get the current user ID and login name."
msgstr ""
#: ga-google-analytics.php:241
msgid "to upgrade WordPress and try again."
msgstr ""
#: inc/settings-display.php:9
msgid "Toggle all panels"
msgstr ""
#: inc/settings-display.php:78
msgid "Toggle open the \"Plugin Settings\" panel on this page (below)"
msgstr ""
#: inc/settings-display.php:165
msgid "Tracking Code Location"
msgstr ""
#: inc/settings-display.php:120
msgid "Tracking Method"
msgstr ""
#: inc/settings-display.php:32
msgid ""
"tracking snippet to your site. Log in to your Google account to view your "
"stats."
msgstr ""
#: ga-google-analytics.php:562
msgid "Universal Analytics"
msgstr ""
#: ga-google-analytics.php:214
msgid "Warning:"
msgstr ""
#: ga-google-analytics.php:216 ga-google-analytics.php:241
msgid "WP Admin Area"
msgstr ""
#: inc/settings-display.php:261
msgid "WP Resources"
msgstr ""
#: inc/support-panel.php:86
msgid "Your generous support helps to ensure future development of"
msgstr ""
#: ga-google-analytics.php:186
msgid "★★★★★ rating&nbsp;&raquo;"
msgstr ""
#: ga-google-analytics.php:315
msgid "🚀 SAVE 30% on Google Analytics Pro!"
msgstr ""

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,337 @@
=== GA Google Analytics Connect Google Analytics to WordPress ===
Plugin Name: GA Google Analytics
Plugin URI: https://perishablepress.com/google-analytics-plugin/
Description: Adds your Google Analytics Tracking Code to your WordPress site.
Tags: analytics, google, google analytics, tracking, statistics
Author: Jeff Starr
Author URI: https://plugin-planet.com/
Donate link: https://monzillamedia.com/donate.html
Contributors: specialk
Requires at least: 4.7
Tested up to: 7.0
Stable tag: 20260421
Version: 20260421
Requires PHP: 5.6.20
Text Domain: ga-google-analytics
Domain Path: /languages
License: GPL v2 or later
Adds Google Analytics tracking code to your WordPress site. Supports many tracking features.
== Description ==
> ✨ Connects Google Analytics to WordPress
> ✨ Easily add Google Analytics 4 to your web pages
This plugin enables Google Analytics for your entire WordPress site. Lightweight and fast with plenty of great features.
### 🔥 Enable Google Analytics 4 ###
Steps to enable Google Analytics 4:
1. Follow [this guide](https://support.google.com/analytics/answer/9304153) to create a GA4 account
2. During account creation, you'll get a tracking (measurement) ID
3. Add your new tracking ID to the plugin setting, "GA Tracking ID"
4. Select "GA4" for the plugin setting, "Tracking Method"
Save changes and done. Wait 24-48 hours before viewing collected data in your GA account.
### 🔥 GA Tracking Options ###
Here are the tracking methods available with this plugin:
* [GA4](https://support.google.com/analytics/answer/10089681) / Google Analytics 4 (default)
* [Universal Analytics](https://support.google.com/analytics/answer/11583528) (deprecated)
* Legacy Tracking (deprecated)
__Note:__ GA4 is recommended. Google has deprecated/disabled all other tracking options.
### 🔥 GA Feature Support ###
* Supports [Google Analytics 4](https://support.google.com/analytics/answer/9304153)
* Supports [Display Advertising](https://support.google.com/analytics/answer/2444872)
* Supports [Enhanced Link Attribution](https://support.google.com/analytics/answer/7377126)
* Supports [IP Anonymization](https://support.google.com/analytics/answer/2763052)
* Supports [Force SSL](https://support.google.com/analytics/answer/6385009)
* Supports [Google Optimize](https://support.google.com/analytics/answer/12979939)
* Supports [Consent Signals](https://support.google.com/analytics/answer/14275483)
* Supports Tracker Objects (Universal Analytics)
* Supports User Opt-Out (Universal Analytics)
Also supports tracking links and conversions via the Custom Code setting. Learn more about [Google Analytics](https://www.google.com/analytics/).
### 🔥 General Features ###
* Blazing fast performance
* Does one thing and does it well
* Drop-dead simple and easy to use
* Regularly updated and "future proof"
* Stays current with the latest tracking code
* Includes tracking code in header or footer
* Includes tracking code on all WordPress web pages
* Includes option to add your own custom markup
* Sleek plugin Settings page with toggling panels
* Option to disable tracking of admin-level users
* Option to enable page tracking in the Admin Area
* Works with or without Gutenberg Block Editor
* Easy to customize the tracking code
* More features available in the [Pro version&nbsp;&raquo;](https://plugin-planet.com/ga-google-analytics-pro/)
This is a lightweight plugin that inserts the required GA tracking code. To view your site statistics, visit your Google Analytics account.
### 🔥 Pro Version ###
[GA Google Analytics Pro](https://plugin-planet.com/ga-google-analytics-pro/) includes the same features as the free version, PLUS the following:
* Visitor Opt-Out Box (frontend UI)
* Configure multiple tracking codes
* Live Preview of all tracking codes
* Choose location of multiple tracking codes
* Supports Custom Code in header or footer
* Disable tracking of all logged-in users
* Disable Tracking for any Post IDs, User Roles, Post Types
* Disable Tracking for Search Results and Post Archives
* Display Opt-Out Box automatically or via shortcode
* Complete Inline Help/Documentation
* Priority plugin help and support
🚀 Learn more and get [GA Pro &raquo;](https://plugin-planet.com/ga-google-analytics-pro/)
### Privacy ###
__User Data:__ This plugin does not collect any user data. Even so, the tracking code added by this plugin is used by Google to collect all sorts of user data. You can learn more about Google Privacy [here](https://policies.google.com/privacy).
__Cookies:__ This plugin uses simple cookies for the visitor Opt-Out Box to remember user preference for opt-in or out of Google Analytics.
__Services:__ This plugin does not connect to any third-party locations or services, but it does enable Google to collect all sorts of data.
GA Google Analytics is developed and maintained by [Jeff Starr](https://x.com/perishable), 15-year [WordPress developer](https://plugin-planet.com/) and [book author](https://books.perishablepress.com/).
### Support development ###
I develop and maintain this free plugin with love for the WordPress community. To show support, you can [make a donation](https://monzillamedia.com/donate.html) or purchase one of my books:
* [The Tao of WordPress](https://wp-tao.com/)
* [Digging into WordPress](https://digwp.com/)
* [.htaccess made easy](https://htaccessbook.com/)
* [WordPress Themes In Depth](https://wp-tao.com/wordpress-themes-book/)
* [Wizard's SQL Recipes for WordPress](https://books.perishablepress.com/downloads/wizards-collection-sql-recipes-wordpress/)
And/or purchase one of my premium WordPress plugins:
* [BBQ Pro](https://plugin-planet.com/bbq-pro/) - Blazing fast WordPress firewall
* [Blackhole Pro](https://plugin-planet.com/blackhole-pro/) - Automatically block bad bots
* [Banhammer Pro](https://plugin-planet.com/banhammer-pro/) - Monitor traffic and ban the bad guys
* [GA Google Analytics Pro](https://plugin-planet.com/ga-google-analytics-pro/) - Connect WordPress to Google Analytics
* [Head Meta Pro](https://plugin-planet.com/head-meta-pro/) - Ultimate Meta Tags for WordPress
* [REST Pro Tools](https://plugin-planet.com/rest-pro-tools/) - Awesome tools for managing the WP REST API
* [Simple Ajax Chat Pro](https://plugin-planet.com/simple-ajax-chat-pro/) - Unlimited chat rooms
* [USP Pro](https://plugin-planet.com/usp-pro/) - Unlimited front-end forms
Links, tweets and likes also appreciated. Thank you! :)
== Installation ==
### How to install the plugin ###
1. Upload the plugin to your blog and activate
2. Visit the settings to configure your options
After configuring your settings, you can verify that GA tracking code is included by viewing the source code of your web pages.
__Note:__ this plugin adds the required GA code to your web pages. In order for the code to do anything, it must correspond to an active, properly configured Google Analytics account. Learn more at the [Google Analytics Help Center](https://support.google.com/analytics/).
[More info on installing WP plugins &raquo;](https://wordpress.org/documentation/article/manage-plugins/#installing-plugins-1)
### How to use the plugin ###
To enable Google Analytics tracking (GA4) on your site, follow these steps:
1. Follow [this guide](https://support.google.com/analytics/answer/9304153) to create a GA 4 account
2. During account creation, you'll get a tracking (measurement) ID
3. Add your new tracking ID to the plugin setting, "GA Tracking ID"
4. Select "GA4" for the plugin setting, "Tracking Method"
5. Configure any other plugin settings as desired (optional)
Save changes and done. After 24-48 hours, you can log into your Google Analytics account and view your site statistics.
__* Notes:__
The "Tracking ID" also may be referred to as "Measurement ID", "Property ID", or "Tag ID".
This plugin adds the required GA code to your web pages. In order for the code to do anything, it must correspond to an active, properly configured Google Analytics account. Learn more at the [Google Analytics Help Center](https://support.google.com/analytics/).
Also note that it can take 24-48 hours after adding the tracking code before any analytical data appears in your [Google Analytics account](https://developers.google.com/analytics/). To check that the GA tacking code is included properly, examine the source code of your web pages. Learn more at the [Google Analytics Help Center](https://support.google.com/analytics/).
### Upgrading Analytics ###
Google Analytics tracking methods [change over time](https://onward.justia.com/history-of-google-analytics/). First there was `urchin.js`, then `ga.js`, `analytics.js`, and then `gtag.js`. Now there is the latest and greatest, "GA4" (Google Analytics 4). If you are using an older version (anything other than GA4) and want to upgrade, check out this [upgrade guide](https://support.google.com/analytics/answer/10759417) from Google.
### Plugin Upgrades ###
Visit the WordPress Plugins screen, locate the plugin, and click "Update" :)
### Restore Default Options ###
To restore default plugin options, either uninstall/reinstall the plugin, or visit the plugin settings &gt; Restore Default Options.
### Uninstalling ###
This plugin cleans up after itself. All plugin settings will be removed from the WordPress database when the plugin is deleted via the WP Plugins screen. Your collected GA data will remain in your Google account.
### Pro Version ###
Want more control over your GA Tracking codes? With awesome features like Opt-Out Box and Code Previews? Check out [GA Pro &raquo;](https://plugin-planet.com/ga-google-analytics-pro/)
### Like the plugin? ###
If you like GA Google Analytics, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/ga-google-analytics/reviews/?rate=5#new-post). It helps to keep development and support going strong. Thank you!
== Screenshots ==
1. GA Google Analytics: Plugin Settings (default)
2. GA Google Analytics: Plugin Settings (expanded)
More screenshots available at the [GA Plugin Homepage](https://perishablepress.com/google-analytics-plugin/).
== Frequently Asked Questions ==
**How to enable Google Analytics 4?**
Check out the top of this page, first section provides the steps to add GA4 to your site.
**I am confused about all the different tracking methods?**
This article should help to get a better idea of the changes: [History of Google Analytics](https://onward.justia.com/history-of-google-analytics/)
**Tracking code is not displayed in source code?**
If you check the source code of your pages and don't see the GA tracking code, check the following:
* Check that your theme includes the hooks, `wp_head` and `wp_footer`
* If you are using a caching plugin, try clearing the cache
If the GA tracking code still is not displayed, most likely there is interference from another plugin or theme. In this case, the best way to resolve the issue is to do some basic [WordPress troubleshooting](https://perishablepress.com/how-to-troubleshoot-wordpress/).
**Google Analytics says tracking code is not detected?**
You need to wait 24-48 hours (or longer) for Google to collect some data. Just takes time for Googlebot to crawl your pages, collect and process data, etc. For more information, check out the [Google Analytics Help Center](https://support.google.com/analytics/thread/293486955/how-long-does-it-take-for-data-to-be-displayed-in-analytics).
**Can I filter the output of the "Custom GA Code" setting?**
Yes, you can use the `gap_custom_code` filter hook.
**How to implement Google Optimize?**
Here are the steps:
1. Enable Universal Analytics in the plugin settings
2. Add the Optimize plugin (e.g., `ga('require', 'GTM-XXXXXX');`) to the setting, "Custom GA Code"
3. Add the Page Hiding (flicker) snippet to the setting, "Custom &lt;head&gt; Code"
4. Enable the setting, "Custom &lt;head&gt; Location"
Done! You can view the source code of your web pages to verify the results.
More info about [Google Optimize](https://support.google.com/analytics/answer/12979939).
**How to enable Opt-out of tracking?**
Here are the steps:
1. Add the following code to the plugin setting, "Custom Code": `<script>window['ga-disable-UA-XXXXX-Y'] = true;</script>`
2. Check the box to enable the setting, "Custom Code Location".
Done! You can view the source code of your web pages to verify the results.
**How to disable the "auto" parameter in ga(create)?**
By default the plugin includes the `auto` parameter in the tracking code:
ga('create', 'GA-123456789000', 'auto');
However some tracking techniques (such as Site Speed Sample Rate) require replacing the `auto` parameter. To do it:
First disable the `auto` parameter by adding the following code to WordPress functions or [custom plugin](https://digwp.com/2022/02/custom-code-wordpress/):
// GA Google Analytics - Disable auto parameter
function ga_google_analytics_enable_auto($enable) { return false; }
add_filter('ga_google_analytics_enable_auto', 'ga_google_analytics_enable_auto');
Now that `auto` is disabled, you can replace it with your own parameter(s). For example, to implement Universal Analytics Site Speed Sample Rate, enter the following code in the plugin setting "Custom Tracker Objects":
{'siteSpeedSampleRate': 100}
Save changes and done. The resulting tracking code will now look like this:
ga('create', 'GA-123456789000', {'siteSpeedSampleRate': 100});
So can adjust things as needed to add any parameters that are required.
**How to add Google Ads Conversion Tracking tags**
Check [this post](https://wordpress.org/support/topic/how-to-add-google-ads-conversion-tracking/) by [@mlipenk](https://wordpress.org/support/users/mlipenk/).
**How to implement Anonymize?**
1. Add to "Custom Tracker Objects" setting: `{ 'anonymize_ip': true }`
2. Save changes and done.
**Got a question?**
To ask a question, suggest a feature, or provide feedback, [contact me directly](https://plugin-planet.com/support/#contact). Learn more about [Google Analytics](https://www.google.com/analytics/).
== Changelog ==
*Thank you to everyone who shares feedback for GA Google Analytics!*
If you like GA Google Analytics, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/ga-google-analytics/reviews/?rate=5#new-post). It helps to keep development and support going strong. Thank you!
> ✨ Pro version available! Check out [GA Pro &raquo;](https://plugin-planet.com/ga-google-analytics-pro/)
**20260421**
* Fixes bug with reset options
* Updates plugin settings page
* Improves readme.txt documentation
* Tests on WordPress 7.0
Full changelog @ [https://plugin-planet.com/wp/changelog/ga-google-analytics.txt](https://plugin-planet.com/wp/changelog/ga-google-analytics.txt)

View File

@@ -0,0 +1,7 @@
<?php // uninstall remove options
if (!defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN')) exit();
// delete options
delete_option('gap_options');
delete_option('ga-google-analytics-dismiss-notice');