Changeset 2721834
- Timestamp:
- 05/11/2022 09:05:03 AM (4 years ago)
- Location:
- amp-google-analytics-4-support/trunk
- Files:
-
- 2 deleted
- 2 edited
-
ampanalyticssupport.php (modified) (4 diffs)
-
inc/ampanalyticssupport-plugin-deactivate.php (deleted)
-
inc/ampanalyticssupport-plugin-insert.php (deleted)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
amp-google-analytics-4-support/trunk/ampanalyticssupport.php
r2721826 r2721834 2 2 /* 3 3 * Plugin Name: AMP Google Analytics 4 Support 4 * Plugin URI: https:/ github.com4 * Plugin URI: https://github.com/rolandfarkasCOM/ampanalyticssupport/ 5 5 * Description: Google Analytics 4 (GA4) AMP support plugin. 6 * Version: 1.0. 16 * Version: 1.0.2 7 7 * Author: Roland Farkas 8 8 * Author URI: https://rolandfarkas.com … … 36 36 add_filter( "plugin_action_links_$this->plugin", array( $this, 'settings_link' ) ); 37 37 add_action( 'admin_menu', array( $this, 'add_admin_pages' ) ); 38 38 39 39 40 } … … 71 72 $ampanalyticssupportActivate = new ampanalyticssupportActivate(); 72 73 $ampanalyticssupportActivate->activate(); 73 } 74 75 function insert() { 76 require_once plugin_dir_path( __FILE__ ) . 'inc/ampanalyticssupport-plugin-insert.php'; 77 $ampanalyticssupportInsert = new ampanalyticssupportInsert(); 78 $ampanalyticssupportInsert->ampanalyticssupport(); 74 79 75 } 80 76 … … 83 79 $ampanalyticssupportPlugin = new ampanalyticssupportPlugin(); 84 80 $ampanalyticssupportPlugin->register(); 85 $ampanalyticssupportPlugin->insert(); 86 81 87 82 // activation 88 83 register_activation_hook( __FILE__, array( $ampanalyticssupportPlugin, 'activate' ) ); 89 90 // deactivation91 require_once plugin_dir_path( __FILE__ ) . 'inc/ampanalyticssupport-plugin-deactivate.php';92 register_deactivation_hook( __FILE__, array( 'ampanalyticssupportPluginDeactivate', 'deactivate' ) );93 84 94 85 register_setting( 'ampanalyticssupport-settings', 'ampanalyticssupport' ); 95 86 } 96 87 88 function page_is_amp() { 89 if ( function_exists( 'amp_is_request' ) ): 90 return amp_is_request(); 91 else : 92 return false; 93 endif; 94 } 97 95 96 // Check if the request is amp and if the amp plugin is active and insert analytics if required. 97 function ampanalyticssupport() { 98 99 include_once ABSPATH . 'wp-admin/includes/plugin.php'; 100 101 if ( is_plugin_active( 'amp/amp.php' ) && page_is_amp()) { 102 //plugin is activated 103 104 echo '<amp-analytics type="googleanalytics" config="/wp-content/plugins/ampanalyticssupport/ga4.json" data-credentials="include"> 105 <script type="application/json"> 106 { 107 "vars": { 108 "GA4_MEASUREMENT_ID": "'.get_option('ampanalyticssupport').'", 109 "GA4_ENDPOINT_HOSTNAME": "www.google-analytics.com", 110 "DEFAULT_PAGEVIEW_ENABLED": true, 111 "GOOGLE_CONSENT_ENABLED": false, 112 "WEBVITALS_TRACKING": false, 113 "PERFORMANCE_TIMING_TRACKING": false 114 } 115 } 116 </script> 117 </amp-analytics>'; 118 } 119 } 120 add_action('wp_footer', 'ampanalyticssupport'); 98 121 99 122 -
amp-google-analytics-4-support/trunk/readme.txt
r2721826 r2721834 4 4 Requires at least: 4.9 5 5 Tested up to: 5.9 6 Stable tag: 1.0. 16 Stable tag: 1.0.2 7 7 License: GPLv3 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 39 39 * Updated Uninstall Process to purge data. 40 40 * Corrected a file name. 41 = 1.0.2 = 42 * Updated deactivate and insert 41 43 42 44 == Credits ==
Note: See TracChangeset
for help on using the changeset viewer.