: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
use ReduxCore\ReduxFramework\Redux;
if ( ! defined( 'ABSPATH' ) ) {
function ampforwp_get_default_analytics($param=""){
$default = ampforwp_get_setting('amp-analytics-select-option');
function ampforwp_analytics_options($opt_name){
Redux::setSection( $opt_name, array(
'title' => esc_html__('Analytics'),
// 'icon' => 'el el-th-large',
'id' => 'amp-analytics-select-option',
'title' => esc_html__( 'Analytics Type', 'accelerated-mobile-pages' ),
'tooltip-subtitle' => esc_html__( 'Select your Analytics provider.', 'accelerated-mobile-pages' ),
'1' => esc_html__('Google Analytics', 'accelerated-mobile-pages' ),
'2' => esc_html__('Segment Analytics', 'accelerated-mobile-pages' ),
'3' => esc_html__('Matomo (Piwik) Analytics', 'accelerated-mobile-pages' ),
'4' => esc_html__('Quantcast Measurement', 'accelerated-mobile-pages' ),
'5' => esc_html__('comScore', 'accelerated-mobile-pages' ),
'6' => esc_html__('Effective Measure', 'accelerated-mobile-pages' ),
'7' => esc_html__('StatCounter', 'accelerated-mobile-pages' ),
'8' => esc_html__('Histats Analytics', 'accelerated-mobile-pages'),
'9' => esc_html__('Yandex Metrika', 'accelerated-mobile-pages'),
'10' => esc_html__('Chartbeat Analytics', 'accelerated-mobile-pages'),
'11' => esc_html__('Alexa Metrics', 'accelerated-mobile-pages'),
'12' => esc_html__('AFS Analytics', 'accelerated-mobile-pages'),
'13' => esc_html__('Adobe Analytics', 'accelerated-mobile-pages'),
'14' => esc_html__('Facebook Pixel', 'accelerated-mobile-pages'),
'15' => esc_html__('Clicky Analytics', 'accelerated-mobile-pages'),
'id' => 'ampforwp-analytics_1',
'title' => esc_html__('Primary Analytics Provider', 'accelerated-mobile-pages'),
'layout_type' => 'accordion',
'id' => 'ampforwp-ga-switch',
'title' => 'Google Analytics',
'default' => ampforwp_get_default_analytics('1'),
array('amp-use-gtm-option', '=' , '0'),
'class' => 'child_opt child_opt_arrow',
'title' => esc_html__( 'Tracking ID', 'accelerated-mobile-pages' ),
array('amp-use-gtm-option', '=' , '0'),
array('ampforwp-ga-switch', '=' , '1'),
array('ampforwp-ga-field-advance-switch', '=' , '0')
'tooltip-subtitle' => esc_html__( 'Enter your Google Analytics ID. Example: UA-XXXXX-Y', 'accelerated-mobile-pages' ),
'default' => 'UA-XXXXX-Y',
'id' => 'ampforwp-ga-field-anonymizeIP',
'title' => esc_html__( 'IP Anonymization', 'accelerated-mobile-pages' ),
array('amp-use-gtm-option', '=' , '0'),
array('ampforwp-ga-switch', '=' , '1')
'id' => 'ampforwp-ga-field-linker',
'title' => esc_html__( 'AMP Linker', 'accelerated-mobile-pages' ),
'required' => array('ampforwp-ga-switch', '=' , '1'),
'tooltip-subtitle' => sprintf( '<a href="%s" target="_blank">%s</a> %s',
esc_url('https://amphtml.wordpress.com/2018/09/17/measuring-user-journeys-across-the-amp-cache-and-your-website/amp/'),
esc_html__( 'Click Here','accelerated-mobile-pages' ),
esc_html__( 'for more details on AMP Linker','accelerated-mobile-pages' ) ),
'id' => 'ampforwp-ga-field-author',
'title' => esc_html__( 'Author Pageview', 'accelerated-mobile-pages' ),
'required' => array('ampforwp-ga-switch', '=' , '1'),
'tooltip-subtitle' => sprintf( '<a href="%s" target="_blank">%s</a> %s',
esc_url('https://ampforwp.com/tutorials/article/how-to-track-author-pageview-analytics-in-amp'),
esc_html__( 'Click Here','accelerated-mobile-pages' ),
esc_html__( 'for more details on Author Pageview','accelerated-mobile-pages' ) ),
'class'=>'child_opt child_opt_arrow',
'id' =>'ampforwp-ga-field-author-index',
'title' => esc_html__('Index of Author','accelerated-mobile-pages'),
'tooltip-subtitle' => 'Index number of author in custom dimension section',
array('ampforwp-ga-field-author', '=' , '1'),
// Advance Tracking options for Google Analytics
'id' => 'ampforwp-ga-field-advance-switch',
'title' => esc_html__( 'Customize Configuration', 'accelerated-mobile-pages' ),
array('amp-use-gtm-option', '=' , '0'),
array('ampforwp-ga-switch', '=' , '1')
'id' => 'ampforwp-ga-field-advance',
'title' => esc_html__('Analytics Code in JSON Format', 'accelerated-mobile-pages'),
'tooltip-subtitle' => sprintf( '%s<a href="%s" target="_blank">%s</a>', esc_html__( 'Tutorial: ','accelerated-mobile-pages' ), esc_url('https://ampforwp.com/tutorials/article/add-advanced-google-analytics-amp/'), esc_html__( 'How To Add Advanced Google Analytics in AMP?','accelerated-mobile-pages' ) ),
array('amp-use-gtm-option', '=' , '0'),
array('ampforwp-ga-switch', '=' , '1'),
array('ampforwp-ga-field-advance-switch', '=' , '1')
"gtag_id": "UA-xxxxxxx-x",
"UA-xxxxxxx-x": { "groups": "default" }
'id' => 'ampforwp-ga4-switch',
'title' => 'Google Analytics 4',
'tooltip-subtitle' => esc_html__( 'Enable Google Analytics 4 in AMP.', 'accelerated-mobile-pages' ),
'class' => 'child_opt child_opt_arrow',
'id' => 'ampforwp-ga4-id',
'title' => esc_html__( 'GA4 Measurement ID', 'accelerated-mobile-pages' ),
array('ampforwp-ga4-switch', '=' , '1'),
array('ampforwp-ga4-field-advance-switch', '=' , '0'),
'tooltip-subtitle' => esc_html__( 'Enter your Your Measurement ID Example: G-XXXXXXXX', 'accelerated-mobile-pages' ),
'default' => 'G-XXXXXXXX',
'id' => 'ampforwp-ga4-gce',
'title' => esc_html__( 'Google Consent Enabled', 'accelerated-mobile-pages' ),
array('ampforwp-ga4-switch', '=' , '1'),
array('ampforwp-ga4-field-advance-switch', '=' , '0'),
'tooltip-subtitle' => esc_html__( 'If this option is enabled then &gcs parameter will be added to the payloads with the current Consent Status', 'accelerated-mobile-pages' ),
'id' => 'ampforwp-ga4-wvt',
'title' => esc_html__( 'Webvitals Tracking', 'accelerated-mobile-pages' ),
array('ampforwp-ga4-switch', '=' , '1'),
array('ampforwp-ga4-field-advance-switch', '=' , '0'),
'tooltip-subtitle' => esc_html__( 'If this option is enabled then webvitals event will fire 5 seconds after the page is visible', 'accelerated-mobile-pages' ),
'id' => 'ampforwp-ga4-ptt',
'title' => esc_html__( 'Performance Timing Tracking', 'accelerated-mobile-pages' ),
array('ampforwp-ga4-switch', '=' , '1'),
array('ampforwp-ga4-field-advance-switch', '=' , '0'),
'tooltip-subtitle' => esc_html__( 'If this option is enabled then performance_timing event including the current page load performance timings', 'accelerated-mobile-pages' ),
// Advance Tracking options for Google Analytics
'id' => 'ampforwp-ga4-field-advance-switch',
'title' => esc_html__( 'Customize Configuration', 'accelerated-mobile-pages' ),
array('amp-use-gtm-option', '=' , '0'),
array('ampforwp-ga4-switch', '=' , '1')
'id' => 'ampforwp-ga4-field-advance',
'title' => esc_html__('Analytics Code in JSON Format', 'accelerated-mobile-pages'),
'tooltip-subtitle' => sprintf( '%s<a href="%s" target="_blank">%s</a>', esc_html__( 'Tutorial: ','accelerated-mobile-pages' ), esc_url('https://ampforwp.com/tutorials/article/how-to-add-ga4-in-ampforwp/'), esc_html__( 'How To Add Advanced Google Analytics in AMP?','accelerated-mobile-pages' ) ),
array('amp-use-gtm-option', '=' , '0'),
array('ampforwp-ga4-switch', '=' , '1'),
array('ampforwp-ga4-field-advance-switch', '=' , '1')
"gtag_id":"G-XXXXXXXXXX",
"G-XXXXXXXXXX":{"groups":"default"}
"on":"visible","request":"pageview"
'id' => 'amp-use-gtm-option',
'title' => esc_html__( 'Google Tag Manager', 'accelerated-mobile-pages' ),
'tooltip-subtitle' => esc_html__( 'Enable GTM Support in AMP.', 'accelerated-mobile-pages' ),
'class'=>'child_opt child_opt_arrow',
'title' => esc_html__('Tag Manager ID (Container ID)','accelerated-mobile-pages'),
'tooltip-subtitle' => sprintf('Eg: GTM-5XXXXXP (<a href="%s" style="color:#f1f1f1;">%s</a>)', esc_url('https://ampforwp.com/tutorials/article/gtm-in-amp/'), esc_html( 'Getting Started?', 'accelerated-mobile-pages') ),
// 'validate' => 'not_empty',
array('amp-use-gtm-option', '=' , '1')
'class'=>'child_opt child_opt_arrow',
'id' =>'amp-gtm-analytics-code',
'title' => esc_html__('Analytics ID','accelerated-mobile-pages'),
'tooltip-subtitle' => 'Eg: UA-XXXXXX-Y',
array('amp-use-gtm-option', '=' , '1'),
array('ampforwp-gtm-field-advance-switch', '=' , '0'),
'id' => 'ampforwp-gtm-field-advance-switch',
'title' => esc_html__( 'Advanced Google Analytics', 'accelerated-mobile-pages' ),
array('amp-use-gtm-option', '=' , '1'),
'id' => 'ampforwp-gtm-field-advance',
'title' => esc_html__('Analytics Code in JSON Format', 'accelerated-mobile-pages'),
'tooltip-subtitle' => sprintf( '%s<a href="%s" target="_blank">%s</a>', esc_html__( 'Tutorial: ','accelerated-mobile-pages' ), esc_url('https://ampforwp.com/tutorials/article/how-to-track-a-click-event-in-gtm-amp/'), esc_html__( 'How To Add Advanced Google Tag Manager in AMP?','accelerated-mobile-pages' ) ),
array('amp-use-gtm-option', '=' , '1'),
array('ampforwp-gtm-field-advance-switch', '=' , '1')
"vars": { "account": "UA-XXXXXX-Y"}
'id' => 'ampforwp-gtm-field-anonymizeIP',
'title' => esc_html__( 'IP Anonymization', 'accelerated-mobile-pages' ),
array('amp-use-gtm-option', '=' , '1'),
'id' => 'ampforwp-ga-clientid-api-gtm',
'desc' => sprintf('<a href="%s" target="_blank">%s</a>', esc_url('https://ampforwp.com/tutorials/article/set-google-amp-client-id-api/'), esc_html__( 'Check this Tutorial to set it up', 'accelerated-mobile-pages' ) ),
'title' => esc_html__('Set up Google AMP Client ID API', 'accelerated-mobile-pages'),
array('amp-use-gtm-option', '=' , '1'),
'id' => 'ampforwp-analytics-conversion-goals',
'title' => esc_html__('Google Analytics Conversion Goals', 'accelerated-mobile-pages'),
'layout_type' => 'accordion',
array('amp-use-gtm-option', '=' , '0'),
'id' => 'ampforwp-analytics-conversion-goals-switch',
'title' => 'Conversion Tracking for GA',
array('amp-use-gtm-option', '=' , '0'),
'id' => 'ampforwp-analytics-conversion-goals-info',
array('ampforwp-analytics-conversion-goals-switch', '=' , true),
'desc' => sprintf('<div style="background: #FFF9C4;padding: 12px;line-height: 1.6;margin: -45px -14px -18px -17px;"><b>%s</b> %s <a href="https://ampforwp.com/addons/conversion-goals-tracking-for-amp/" target="_blank">%s</a> extension.<br /> <div style="margin-top:4px;">(<a href="https://ampforwp.com/addons/conversion-goals-tracking-for-amp/" target="_blank">%s</a>)</div></div>',esc_html__( 'ONE LAST STEP REQUIRED:','accelerated-mobile-pages'),esc_html__( 'This feature requires', 'accelerated-mobile-pages' ),esc_html__( 'Conversion Goals Tracking for AMP', 'accelerated-mobile-pages'),esc_html__( 'Click here for more info', 'accelerated-mobile-pages' )),
'id' => 'ampforwp-analytics_2',
'title' => esc_html__('General Analytics Providers', 'accelerated-mobile-pages'),
'layout_type' => 'accordion',
'title' => esc_html__('Facebook Pixel','accelerated-mobile-pages'),
'tooltip-subtitle' => sprintf('%s <a href="%s" target="_blank">%s</a> %s',
esc_html__('Enable this option to track facebook pixel in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-add-facebook-pixel-in-amp/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages')),
'id' =>'amp-fb-pixel-id',
'title' => esc_html__('Facebook Pixel ID','accelerated-mobile-pages'),
'desc' => 'Example: 153246987501548',
array('amp-fb-pixel', '=' , '1')),
'id' => 'ampforwp-Segment-switch',
'title' => 'Segment Analytics',
'default' => ampforwp_get_default_analytics('2'),
'tooltip-subtitle' => sprintf('%s <a href="%s" target="_blank">%s</a> %s',
esc_html__('Enable this option to track segment analytics in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-add-segment-analytics-in-amp/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages')),
'title' => esc_html__( 'Segment Analytics', 'accelerated-mobile-pages' ),
'tooltip-subtitle' => esc_html__( 'Enter your Segment Analytics Key.', 'accelerated-mobile-pages' ),
array('ampforwp-Segment-switch', '=' , '1')
'default' => 'SEGMENT-WRITE-KEY',
'id' => 'ampforwp-Piwik-switch',
'title' => esc_html__('Matomo (Piwik) Analytics', 'accelerated-mobile-pages' ),
'default' => ampforwp_get_default_analytics('3'),
'tooltip-subtitle' => sprintf('%s <a href="%s" target="_blank">%s</a> %s',
esc_html__('Enable this option to track matomo (piwik) analytics in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-add-matomo-piwik-analytics-in-amp/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages')),
'title' => esc_html__( ' Enter Your Piwik Analytics URL', 'accelerated-mobile-pages' ),
'desc'=>sprintf( 'Example -
https://YOUR_PIWIK_BASE_INSTALLATION_URL/piwik.php?idsite=1&rec=1&
action_name=TITLE&urlref=DOCUMENT_REFERRER&url=CANONICAL_URL&
rand=RANDOM <a href="https://ampforwp.com/tutorials/article/how-to-add-matomo-piwik-analytics-in-amp/" target="_blank">%s</a>',esc_html__('View integration tutorial','accelerated-mobile-pages' )),
array('ampforwp-Piwik-switch', '=' , '1')
'tooltip-subtitle' => sprintf('%s<a href="%s" target="_blank">%s</a>', esc_html__( 'Tutorial: ','accelerated-mobile-pages' ), esc_url('https://ampforwp.com/tutorials/article/how-to-add-matomo-piwik-analytics-in-amp/'), esc_html__( 'How to add Matomo Piwik Analytics in AMP?','accelerated-mobile-pages') ),
'id' => 'ampforwp-Piwik-Pro-switch',
'title' => esc_html__('Piwik Pro Analytics', 'accelerated-mobile-pages' ),
'default' => ampforwp_get_default_analytics('17'),
'tooltip-subtitle' => sprintf('%s <a href="%s" target="_blank">%s</a> %s',
esc_html__('Enable this option to track matomo Piwik Pro analytics in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-add-piwik-pro-analytics-in-amp/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages')),
'title' => esc_html__( ' Piwik PRO Host URL', 'accelerated-mobile-pages' ),
'desc'=>sprintf( 'Example - analytics.example.com') ,
array('ampforwp-Piwik-Pro-switch', '=' , '1')
'tooltip-subtitle' => sprintf('%s<a href="%s" target="_blank">%s</a>', esc_html__( 'Tutorial: ','accelerated-mobile-pages' ), esc_url('https://ampforwp.com/tutorials/article/how-to-add-piwik-pro-analytics-in-amp/'), esc_html__( 'How to add Piwik Pro nalytics in AMP?','accelerated-mobile-pages') ),
'id' => 'ppas-website-id',
'title' => esc_html__( ' Piwik PRO Website Id', 'accelerated-mobile-pages' ),
'desc'=>sprintf( 'Example - 12345678-1234-1234-1234-1234567890ab') ,
array('ampforwp-Piwik-Pro-switch', '=' , '1')
'tooltip-subtitle' => sprintf('%s<a href="%s" target="_blank">%s</a>', esc_html__( 'Tutorial: ','accelerated-mobile-pages' ), esc_url('https://ampforwp.com/tutorials/article/how-to-add-piwik-pro-analytics-in-amp/'), esc_html__( 'How to add Piwik Pro Analytics in AMP?','accelerated-mobile-pages') ),
'id' => 'ppas-website-hash',
'title' => esc_html__( ' Piwik PRO Website hash', 'accelerated-mobile-pages' ),
'desc'=>sprintf( 'Example - cdef') ,
array('ampforwp-Piwik-Pro-switch', '=' , '1')
'tooltip-subtitle' => sprintf('%s<a href="%s" target="_blank">%s</a>', esc_html__( 'Tutorial: ','accelerated-mobile-pages' ), esc_url('https://ampforwp.com/tutorials/article/how-to-add-piwik-pro-analytics-in-amp/'), esc_html__( 'How to add Piwik Pro Analytics in AMP?','accelerated-mobile-pages') ),
'id' => 'ppas-advanced-tracking',
'title' => esc_html__('Advance Tracking', 'accelerated-mobile-pages' ),
array('ampforwp-Piwik-Pro-switch', '=' , '1')
esc_html__('Enable this option to add custom triggers to Piwik Pro analytics in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-add-piwik-pro-analytics-in-amp/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages'),