Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/accelera.../includes/features/analytic...
File: analytics-functions.php
<?php
[0] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[1] Fix | Delete
exit;
[2] Fix | Delete
}
[3] Fix | Delete
// Analytics Area
[4] Fix | Delete
add_action('amp_post_template_footer','ampforwp_analytics',11);
[5] Fix | Delete
function ampforwp_analytics() {
[6] Fix | Delete
// 10.1 Analytics Support added for Google Analytics
[7] Fix | Delete
global $redux_builder_amp;
[8] Fix | Delete
if ( true == ampforwp_get_setting('ampforwp-ga-switch') && false == ampforwp_get_setting('amp-use-gtm-option') ){
[9] Fix | Delete
$ga_fields = array();
[10] Fix | Delete
$ampforwp_ga_fields = array();
[11] Fix | Delete
$ga_account = '';
[12] Fix | Delete
$ga_account = ampforwp_get_setting('ga-feild');
[13] Fix | Delete
$ga_account = str_replace(' ', '', $ga_account);
[14] Fix | Delete
$ga_fields = array(
[15] Fix | Delete
'vars'=>array(
[16] Fix | Delete
'gtag_id'=>$ga_account,
[17] Fix | Delete
),
[18] Fix | Delete
);
[19] Fix | Delete
$ga_fields['vars']['config'] = array(
[20] Fix | Delete
$ga_account=> array(
[21] Fix | Delete
'groups'=>'default',
[22] Fix | Delete
)
[23] Fix | Delete
);
[24] Fix | Delete
$ga_fields['triggers'] = array(
[25] Fix | Delete
'trackPageview'=> array(
[26] Fix | Delete
'on'=>'visible',
[27] Fix | Delete
'request'=>'pageview'
[28] Fix | Delete
)
[29] Fix | Delete
);
[30] Fix | Delete
if (true == ampforwp_get_setting('ampforwp-infinite-scroll')) {
[31] Fix | Delete
$url = ampforwp_url_controller(get_the_permalink());
[32] Fix | Delete
$ga_fields['requests'] = array(
[33] Fix | Delete
'nextpage' => esc_url($url) ,
[34] Fix | Delete
);
[35] Fix | Delete
$ga_fields['triggers'] = array(
[36] Fix | Delete
'trackPageview'=> array(
[37] Fix | Delete
'on'=>'visible',
[38] Fix | Delete
'request'=>'pageview'
[39] Fix | Delete
),
[40] Fix | Delete
'trackScrollThrough'=> array(
[41] Fix | Delete
'on'=>'amp-next-page-scroll',
[42] Fix | Delete
'request'=>'nextpage'
[43] Fix | Delete
),
[44] Fix | Delete
'trackClickThrough'=> array(
[45] Fix | Delete
'on'=>'amp-next-page-click',
[46] Fix | Delete
'request'=>'nextpage'
[47] Fix | Delete
)
[48] Fix | Delete
);
[49] Fix | Delete
}
[50] Fix | Delete
if ( true == ampforwp_get_setting('ampforwp-ga-field-anonymizeIP')) {
[51] Fix | Delete
$ga_fields['vars']['anonymizeIP'] = 'true';
[52] Fix | Delete
}
[53] Fix | Delete
if ( ampforwp_get_setting('ampforwp-ga-field-linker') == true ) {
[54] Fix | Delete
$ga_fields['vars']['linkers'] = array(
[55] Fix | Delete
'enabled'=> true
[56] Fix | Delete
);
[57] Fix | Delete
}
[58] Fix | Delete
if (ampforwp_get_setting('ampforwp-ga-field-author')) {
[59] Fix | Delete
$author = ampforwp_get_setting('ampforwp-ga-field-author-index');
[60] Fix | Delete
if ($author) {
[61] Fix | Delete
$ga_fields['vars']['config'][$author] = get_the_author_meta('display_name');
[62] Fix | Delete
}
[63] Fix | Delete
}
[64] Fix | Delete
$ga_fields = apply_filters('ampforwp_google_analytics_fields', $ga_fields );
[65] Fix | Delete
$ampforwp_ga_fields = wp_json_encode( $ga_fields);
[66] Fix | Delete
if( ampforwp_get_setting('ampforwp-ga-field-advance-switch') ){
[67] Fix | Delete
$ampforwp_ga_fields = apply_filters('ampforwp_advance_google_analytics', $ampforwp_ga_fields );
[68] Fix | Delete
$ampforwp_ga_fields = preg_replace('!/\*.*?\*/!s', '', $ampforwp_ga_fields);
[69] Fix | Delete
$ampforwp_ga_fields = preg_replace('/\n\s*\n/', '', $ampforwp_ga_fields);
[70] Fix | Delete
?>
[71] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="gtag" id="analytics1">
[72] Fix | Delete
<script type="application/json">
[73] Fix | Delete
<?php echo $ampforwp_ga_fields; ?>
[74] Fix | Delete
</script>
[75] Fix | Delete
</amp-analytics>
[76] Fix | Delete
<?php } else if (!empty($ga_account) && $ga_account != "UA-XXXXX-Y") { ?>
[77] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="gtag" id="analytics1" data-credentials="include" >
[78] Fix | Delete
<script type="application/json">
[79] Fix | Delete
<?php echo $ampforwp_ga_fields; ?>
[80] Fix | Delete
</script>
[81] Fix | Delete
</amp-analytics>
[82] Fix | Delete
<?php }
[83] Fix | Delete
}//code ends for supporting Google Analytics
[84] Fix | Delete
[85] Fix | Delete
[86] Fix | Delete
// Code Starts for Google Analytics 4
[87] Fix | Delete
// Original code by David Vallejo
[88] Fix | Delete
// ga4.json - https://github.com/analytics-debugger/google-analytics-4-for-amp
[89] Fix | Delete
if( function_exists('ampforwp_get_setting') && ampforwp_get_setting('ampforwp-ga4-switch') == true ){
[90] Fix | Delete
$ga4_fields = array();
[91] Fix | Delete
$ampforwp_ga4_fields = array();
[92] Fix | Delete
$ga4_id = ampforwp_get_setting('ampforwp-ga4-id');
[93] Fix | Delete
$ga4_id = str_replace(' ', '', $ga4_id);
[94] Fix | Delete
$ga4_fields = array(
[95] Fix | Delete
'vars'=>array(
[96] Fix | Delete
'gtag_id'=>$ga4_id,
[97] Fix | Delete
),
[98] Fix | Delete
);
[99] Fix | Delete
$url = parse_url( home_url() , PHP_URL_HOST );
[100] Fix | Delete
$ga4_fields['vars']['config'] = array(
[101] Fix | Delete
$ga4_id=> array(
[102] Fix | Delete
'groups'=>'default',
[103] Fix | Delete
)
[104] Fix | Delete
);
[105] Fix | Delete
$ga4_fields['triggers'] = array(
[106] Fix | Delete
'trackPageview'=> array(
[107] Fix | Delete
'on'=>'visible',
[108] Fix | Delete
'request'=>'pageview'
[109] Fix | Delete
)
[110] Fix | Delete
);
[111] Fix | Delete
if( ampforwp_get_setting('ampforwp-ga4-wvt') == 1 ){
[112] Fix | Delete
$ga4_fields['triggers'] = array(
[113] Fix | Delete
'webVitals'=> array(
[114] Fix | Delete
'on'=>'timer',
[115] Fix | Delete
'timerSpec'=>array(
[116] Fix | Delete
'interval' => 5,
[117] Fix | Delete
'maxTimerLength' => 4.99,
[118] Fix | Delete
'immediate' => false,
[119] Fix | Delete
),
[120] Fix | Delete
'request'=>'event',
[121] Fix | Delete
'vars'=>array(
[122] Fix | Delete
'event_name' => 'web_vitals',
[123] Fix | Delete
),
[124] Fix | Delete
'extraUrlParams'=>array(
[125] Fix | Delete
'event__num_first_contenful_paint' => 'FIRST_CONTENTFUL_PAINT',
[126] Fix | Delete
'event__num_first_viewport_ready' => 'FIRST_VIEWPORT_READY',
[127] Fix | Delete
'event__num_make_body_visible' => 'MAKE_BODY_VISIBLE',
[128] Fix | Delete
'event__num_largest_contentful_paint' => 'LARGEST_CONTENTFUL_PAINT',
[129] Fix | Delete
'event__num_cumulative_layout_shift' => 'CUMULATIVE_LAYOUT_SHIFT',
[130] Fix | Delete
),
[131] Fix | Delete
)
[132] Fix | Delete
);
[133] Fix | Delete
}
[134] Fix | Delete
if( ampforwp_get_setting('ampforwp-ga4-ptt') == 1 ){
[135] Fix | Delete
$ga4_fields['triggers'] = array(
[136] Fix | Delete
'performanceTiming'=> array(
[137] Fix | Delete
'on'=>'visible',
[138] Fix | Delete
'request'=>'event',
[139] Fix | Delete
'sampleSpec'=>array(
[140] Fix | Delete
'sampleOn' => '${clientId}',
[141] Fix | Delete
'threshold' => 100,
[142] Fix | Delete
),
[143] Fix | Delete
'vars'=>array(
[144] Fix | Delete
'event_name' => 'performance_timing',
[145] Fix | Delete
),
[146] Fix | Delete
'extraUrlParams'=>array(
[147] Fix | Delete
'event__num_page_load_time' => '${pageLoadTime}',
[148] Fix | Delete
'event__num_domain_lookup_time' => '${domainLookupTime}',
[149] Fix | Delete
'event__num_tcp_connect_time' => '${tcpConnectTime}',
[150] Fix | Delete
'event__num_redirect_time' => '${redirectTime}',
[151] Fix | Delete
'event__num_server_response_time' => '${serverResponseTime}',
[152] Fix | Delete
'event__num_page_download_time' => '${pageDownloadTime}',
[153] Fix | Delete
'event__num_content_download_time' => '${contentLoadTime}',
[154] Fix | Delete
'event__num_dom_interactive_time' => '${domInteractiveTime}',
[155] Fix | Delete
),
[156] Fix | Delete
)
[157] Fix | Delete
);
[158] Fix | Delete
}
[159] Fix | Delete
if ( ampforwp_get_setting('ampforwp-ga4-gce') == 1 ) {
[160] Fix | Delete
$ga4_fields['extraUrlParams'] = array(
[161] Fix | Delete
'gcs' => '$IF($EQUALS(true,TRUE),G10$IF($EQUALS(CONSENT_STATE,sufficient),1,0),)',
[162] Fix | Delete
);
[163] Fix | Delete
}
[164] Fix | Delete
$ampforwp_ga4_fields = wp_json_encode( $ga4_fields);
[165] Fix | Delete
if( ampforwp_get_setting('ampforwp-ga4-field-advance-switch') ){
[166] Fix | Delete
$ampforwp_ga4_fields = apply_filters('ampforwp_advance_google_analytics4', $ampforwp_ga4_fields );
[167] Fix | Delete
$ampforwp_ga4_fields = preg_replace('!/\*.*?\*/!s', '', $ampforwp_ga4_fields);
[168] Fix | Delete
$ampforwp_ga4_fields = preg_replace('/\n\s*\n/', '', $ampforwp_ga4_fields);
[169] Fix | Delete
?>
[170] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="gtag" id="analytics1">
[171] Fix | Delete
<script type="application/json">
[172] Fix | Delete
<?php echo $ampforwp_ga4_fields; ?>
[173] Fix | Delete
</script>
[174] Fix | Delete
</amp-analytics>
[175] Fix | Delete
<?php } else if (!empty($ga4_id)) { ?>
[176] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="gtag" id="analytics1" data-credentials="include" >
[177] Fix | Delete
<script type="application/json">
[178] Fix | Delete
<?php echo $ampforwp_ga4_fields; ?>
[179] Fix | Delete
</script>
[180] Fix | Delete
</amp-analytics>
[181] Fix | Delete
<?php }
[182] Fix | Delete
}
[183] Fix | Delete
//Code Ends for Google Analytics 4
[184] Fix | Delete
[185] Fix | Delete
// 10.2 Analytics Support added for clicky.com
[186] Fix | Delete
if ( true == ampforwp_get_setting('amp-clicky-switch') ) {
[187] Fix | Delete
$clicky_site_id = ampforwp_get_setting('clicky-site-id');
[188] Fix | Delete
$clicky_fields = array(
[189] Fix | Delete
'vars'=>array(
[190] Fix | Delete
'site_id'=> $clicky_site_id,
[191] Fix | Delete
)
[192] Fix | Delete
);
[193] Fix | Delete
$clicky_fields = apply_filters('ampforwp_clicky_analytics', $clicky_fields );?>
[194] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="clicky">
[195] Fix | Delete
<script type="application/json">
[196] Fix | Delete
<?php echo wp_json_encode( $clicky_fields); ?>
[197] Fix | Delete
</script>
[198] Fix | Delete
</amp-analytics>
[199] Fix | Delete
<?php
[200] Fix | Delete
}
[201] Fix | Delete
[202] Fix | Delete
// 10.2 Analytics Support added for segment.com
[203] Fix | Delete
if ( true == ampforwp_get_setting('ampforwp-Segment-switch') ) {
[204] Fix | Delete
$segment = ampforwp_get_setting('sa-feild');
[205] Fix | Delete
$segment_fields = array(
[206] Fix | Delete
'vars'=>array(
[207] Fix | Delete
'writeKey'=>$segment,
[208] Fix | Delete
'name'=>get_the_title()
[209] Fix | Delete
),
[210] Fix | Delete
);
[211] Fix | Delete
$segment_fields = apply_filters('ampforwp_segment_analytics', $segment_fields );?>
[212] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="segment">
[213] Fix | Delete
<script type="application/json">
[214] Fix | Delete
<?php echo wp_json_encode( $segment_fields); ?>
[215] Fix | Delete
</script>
[216] Fix | Delete
</amp-analytics>
[217] Fix | Delete
<?php
[218] Fix | Delete
}
[219] Fix | Delete
[220] Fix | Delete
// 10.3 Analytics Support added for Piwik
[221] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-Piwik-switch')){
[222] Fix | Delete
$idsite = ampforwp_get_setting('pa-feild');
[223] Fix | Delete
$title = urlencode(get_the_title());
[224] Fix | Delete
$url = get_the_permalink();
[225] Fix | Delete
if (function_exists( 'is_ssl' ) && !is_ssl()) {
[226] Fix | Delete
$url = ampforwp_remove_protocol(ampforwp_url_controller($url));
[227] Fix | Delete
}else{
[228] Fix | Delete
ampforwp_url_controller($url);
[229] Fix | Delete
}
[230] Fix | Delete
$rand = rand(1111,9999);
[231] Fix | Delete
$referer = $url;
[232] Fix | Delete
if(isset($_SERVER['HTTP_REFERER'])) {
[233] Fix | Delete
$referer = $_SERVER['HTTP_REFERER'];
[234] Fix | Delete
}
[235] Fix | Delete
$piwik_api = str_replace("YOUR_SITE_ID", '1', $idsite[0]);
[236] Fix | Delete
$piwik_api = str_replace("TITLE", esc_attr($title), $piwik_api);
[237] Fix | Delete
$piwik_api = str_replace("DOCUMENT_REFERRER", esc_url($referer), $piwik_api);
[238] Fix | Delete
$piwik_api = str_replace("CANONICAL_URL", esc_url($url), $piwik_api);
[239] Fix | Delete
$piwik_api = str_replace("RANDOM", intval($rand), $piwik_api);
[240] Fix | Delete
?>
[241] Fix | Delete
<amp-pixel src="<?php echo $piwik_api; // XXS ok, escaped above?>"></amp-pixel>
[242] Fix | Delete
<?php }
[243] Fix | Delete
[244] Fix | Delete
// 10.4 Analytics Support added for quantcast
[245] Fix | Delete
if ( true == ampforwp_get_setting('ampforwp-Quantcast-switch')) {
[246] Fix | Delete
$quantcast = ampforwp_get_setting('amp-quantcast-analytics-code');
[247] Fix | Delete
$quantcast_fields = array(
[248] Fix | Delete
'vars'=>array(
[249] Fix | Delete
'pcode'=>$quantcast,
[250] Fix | Delete
'labels'=> array("AMPProject")
[251] Fix | Delete
),
[252] Fix | Delete
);
[253] Fix | Delete
$quantcast_fields = apply_filters('ampforwp_quantcast_analytics', $quantcast_fields );?>
[254] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="quantcast">
[255] Fix | Delete
<script type="application/json">
[256] Fix | Delete
<?php echo wp_json_encode( $quantcast_fields); ?>
[257] Fix | Delete
</script>
[258] Fix | Delete
</amp-analytics>
[259] Fix | Delete
<?php
[260] Fix | Delete
}
[261] Fix | Delete
[262] Fix | Delete
// 10.5 Analytics Support added for comscore
[263] Fix | Delete
if ( true == ampforwp_get_setting('ampforwp-comScore-switch')) {
[264] Fix | Delete
$comscore_c1 = ampforwp_get_setting('amp-comscore-analytics-code-c1');
[265] Fix | Delete
$comscore_c2 = ampforwp_get_setting('amp-comscore-analytics-code-c2');
[266] Fix | Delete
[267] Fix | Delete
$comscore_fields = array(
[268] Fix | Delete
'vars'=>array(
[269] Fix | Delete
'c1'=>$comscore_c1,
[270] Fix | Delete
'c2'=>$comscore_c2
[271] Fix | Delete
),
[272] Fix | Delete
'extraUrlParams'=> array(
[273] Fix | Delete
'comscorekw'=> 'amp'
[274] Fix | Delete
),
[275] Fix | Delete
);
[276] Fix | Delete
$comscore_fields = apply_filters('ampforwp_comscore_analytics', $comscore_fields );?>
[277] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="comscore">
[278] Fix | Delete
<script type="application/json">
[279] Fix | Delete
<?php echo wp_json_encode( $comscore_fields); ?>
[280] Fix | Delete
</script>
[281] Fix | Delete
</amp-analytics>
[282] Fix | Delete
<?php
[283] Fix | Delete
}
[284] Fix | Delete
[285] Fix | Delete
// 10.6 Analytics Support added for Effective Measure
[286] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-Effective-switch')) { ?>
[287] Fix | Delete
<!-- BEGIN EFFECTIVE MEASURE CODE -->
[288] Fix | Delete
<amp-pixel <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> src="<?php echo ampforwp_get_setting('eam-feild'); ?>" />
[289] Fix | Delete
<!--END EFFECTIVE MEASURE CODE -->
[290] Fix | Delete
<?php }
[291] Fix | Delete
[292] Fix | Delete
// 10.7 Analytics Support added for StatCounter
[293] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-StatCounter-switch')) { ?>
[294] Fix | Delete
<!-- BEGIN StatCounter CODE -->
[295] Fix | Delete
<div id="statcounter">
[296] Fix | Delete
<amp-pixel <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> src="<?php echo ampforwp_get_setting('sc-feild'); ?>" >
[297] Fix | Delete
</amp-pixel>
[298] Fix | Delete
</div>
[299] Fix | Delete
<!--END StatCounter CODE -->
[300] Fix | Delete
<?php }
[301] Fix | Delete
[302] Fix | Delete
// 10.8 Analytics Support added for Histats Analytics
[303] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-Histats-switch')) {
[304] Fix | Delete
$url = add_query_arg(esc_attr(ampforwp_get_setting('histats-field')), '', '//sstatic1.histats.com/0.gif');
[305] Fix | Delete
$url = add_query_arg('101', '', $url); ?>
[306] Fix | Delete
<!-- BEGIN Histats CODE -->
[307] Fix | Delete
<div id="histats">
[308] Fix | Delete
<amp-pixel <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> src="<?php echo esc_url_raw($url); ?>" >
[309] Fix | Delete
</amp-pixel>
[310] Fix | Delete
</div>
[311] Fix | Delete
<!--END Histats CODE -->
[312] Fix | Delete
<?php }
[313] Fix | Delete
[314] Fix | Delete
// 10.9 Analytics Support added for Yandex Metrika Analytics
[315] Fix | Delete
if ( true == ampforwp_get_setting('ampforwp-Yandex-switch')){
[316] Fix | Delete
$yandex = ampforwp_get_setting('amp-Yandex-Metrika-analytics-code');
[317] Fix | Delete
$yandex_fields = array(
[318] Fix | Delete
'vars'=>array(
[319] Fix | Delete
'counterId'=>$yandex,
[320] Fix | Delete
),
[321] Fix | Delete
'triggers'=> array(
[322] Fix | Delete
'notBounce'=> array(
[323] Fix | Delete
'on'=>'timer',
[324] Fix | Delete
'timerSpec'=> array(
[325] Fix | Delete
'immediate'=>'false',
[326] Fix | Delete
'interval'=>'15',
[327] Fix | Delete
'maxTimerLength'=>'16',
[328] Fix | Delete
),
[329] Fix | Delete
'request'=>'notBounce'
[330] Fix | Delete
)
[331] Fix | Delete
[332] Fix | Delete
)
[333] Fix | Delete
);
[334] Fix | Delete
$yandex_fields = apply_filters('ampforwp_yandex_analytics', $yandex_fields );?>
[335] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="metrika">
[336] Fix | Delete
<script type="application/json">
[337] Fix | Delete
<?php echo wp_json_encode( $yandex_fields); ?>
[338] Fix | Delete
</script>
[339] Fix | Delete
</amp-analytics>
[340] Fix | Delete
<?php }//code ends for supporting Yandex Metrika Analytics
[341] Fix | Delete
[342] Fix | Delete
// 10.10 Analytics Support added for Chartbeat Analytics
[343] Fix | Delete
if ( true == ampforwp_get_setting('ampforwp-Chartbeat-switch')){
[344] Fix | Delete
$chartbeat = ampforwp_get_setting('amp-Chartbeat-analytics-code');
[345] Fix | Delete
$ampforwp_chartbeat_fields = array(
[346] Fix | Delete
'vars'=>array(
[347] Fix | Delete
'uid'=>$chartbeat,
[348] Fix | Delete
'domain'=>ampforwp_remove_protocol(site_url()),
[349] Fix | Delete
'title'=>get_the_title(),
[350] Fix | Delete
'authors'=>get_the_author_meta('display_name'),
[351] Fix | Delete
),
[352] Fix | Delete
[353] Fix | Delete
);
[354] Fix | Delete
$ampforwp_chartbeat_fields = apply_filters('ampforwp_chartbeat_analytics', $ampforwp_chartbeat_fields );?>
[355] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="chartbeat">
[356] Fix | Delete
<script type="application/json">
[357] Fix | Delete
<?php echo wp_json_encode( $ampforwp_chartbeat_fields); ?>
[358] Fix | Delete
</script>
[359] Fix | Delete
</amp-analytics>
[360] Fix | Delete
<?php
[361] Fix | Delete
}//code ends for supporting Chartbeat Analytics
[362] Fix | Delete
[363] Fix | Delete
// 10.11 Analytics Support added for Alexa Metrics
[364] Fix | Delete
if ( true == ampforwp_get_setting('ampforwp-Alexa-switch')) {
[365] Fix | Delete
$alexa = ampforwp_get_setting('ampforwp-alexa-account');
[366] Fix | Delete
$domain = ampforwp_get_setting('ampforwp-alexa-domain');
[367] Fix | Delete
$alexa_fields = array(
[368] Fix | Delete
'vars'=>array(
[369] Fix | Delete
'atrk_acct'=>$alexa,
[370] Fix | Delete
'domain'=>$domain
[371] Fix | Delete
),
[372] Fix | Delete
[373] Fix | Delete
);
[374] Fix | Delete
$alexa_fields = apply_filters('ampforwp_alexa_analytics', $alexa_fields );?>
[375] Fix | Delete
<!-- Start Alexa AMP Certify Javascript -->
[376] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="alexametrics">
[377] Fix | Delete
<script type="application/json">
[378] Fix | Delete
<?php echo wp_json_encode( $alexa_fields,JSON_UNESCAPED_SLASHES); ?>
[379] Fix | Delete
</script>
[380] Fix | Delete
</amp-analytics>
[381] Fix | Delete
<!-- End Alexa AMP Certify Javascript -->
[382] Fix | Delete
<?php
[383] Fix | Delete
}
[384] Fix | Delete
// 10.12 Analytics Support added for AFS Analytics
[385] Fix | Delete
if ( ampforwp_get_setting('ampforwp-afs-analytics-switch') && true == ampforwp_get_setting('ampforwp-afs-analytics-switch')) {
[386] Fix | Delete
$afs_account = ampforwp_get_setting('ampforwp-afs-siteid');
[387] Fix | Delete
$afs_server = "www";
[388] Fix | Delete
if ($afs_account > 99999)
[389] Fix | Delete
$afs_server = 'www1';
[390] Fix | Delete
if ($afs_account > 199999)
[391] Fix | Delete
$afs_server = 'www2';
[392] Fix | Delete
if ($afs_account > 299999)
[393] Fix | Delete
$afs_server = 'www3';
[394] Fix | Delete
if ($afs_account > 399999)
[395] Fix | Delete
$afs_server = 'www4';
[396] Fix | Delete
if ($afs_account > 499999)
[397] Fix | Delete
$afs_server = 'www5';
[398] Fix | Delete
if ($afs_account > 599999)
[399] Fix | Delete
$afs_server = 'www6';
[400] Fix | Delete
if ($afs_account > 699999)
[401] Fix | Delete
$afs_server = 'www7';
[402] Fix | Delete
if ($afs_account > 799999)
[403] Fix | Delete
$afs_server = 'www8';
[404] Fix | Delete
if ($afs_account > 899999)
[405] Fix | Delete
$afs_server = 'www9';
[406] Fix | Delete
if ($afs_account > 999999)
[407] Fix | Delete
$afs_server = 'www10';
[408] Fix | Delete
$afs_fields = array(
[409] Fix | Delete
'vars'=>array(
[410] Fix | Delete
'server'=>$afs_server,
[411] Fix | Delete
'websiteid'=>$afs_account,
[412] Fix | Delete
'title'=>get_the_title(),
[413] Fix | Delete
'url'=>site_url()
[414] Fix | Delete
),
[415] Fix | Delete
[416] Fix | Delete
);
[417] Fix | Delete
$afs_fields = apply_filters('ampforwp_afs_analytics', $afs_fields );?>
[418] Fix | Delete
<!-- Start AFS Analytics Javascript -->
[419] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="afsanalytics">
[420] Fix | Delete
<script type="application/json">
[421] Fix | Delete
<?php echo wp_json_encode( $afs_fields); ?>
[422] Fix | Delete
</script>
[423] Fix | Delete
</amp-analytics>
[424] Fix | Delete
<!-- End AFS Analytics Javascript -->
[425] Fix | Delete
<?php
[426] Fix | Delete
}
[427] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-callrail-switch')) {
[428] Fix | Delete
$config_url = $number = $analytics_url = '';
[429] Fix | Delete
$config_url = ampforwp_get_setting('ampforwp-callrail-config-url');
[430] Fix | Delete
$number = ampforwp_get_setting('ampforwp-callrail-number');
[431] Fix | Delete
$analytics_url = ampforwp_get_setting('ampforwp-callrail-analytics-url');
[432] Fix | Delete
if(!empty($config_url) && !empty($number) && !empty($analytics_url)){?>
[433] Fix | Delete
<?php } }
[434] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-dotmetrics-switch')) {
[435] Fix | Delete
$dot_id = '';
[436] Fix | Delete
$dot_id = ampforwp_get_setting('ampforwp-dotmetrics-id');
[437] Fix | Delete
if(!empty($dot_id)){
[438] Fix | Delete
$analytics_url = "https://script.dotmetrics.net/AmpConfig.json?id=".esc_html($dot_id); ?>
[439] Fix | Delete
<amp-analytics config="<?php echo esc_url_raw($analytics_url); ?>"></amp-analytics>
[440] Fix | Delete
<?php } }
[441] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-topmailru-switch')) {
[442] Fix | Delete
$topmailru_id = '';
[443] Fix | Delete
$topmailru_id = ampforwp_get_setting('ampforwp-topmailru-id');
[444] Fix | Delete
if(!empty($topmailru_id)){ ?>
[445] Fix | Delete
<amp-analytics type="topmailru" id="topmailru">
[446] Fix | Delete
<script type="application/json">
[447] Fix | Delete
{
[448] Fix | Delete
"vars": {
[449] Fix | Delete
"id": "<?php echo esc_attr($topmailru_id);?>"
[450] Fix | Delete
}
[451] Fix | Delete
}
[452] Fix | Delete
</script>
[453] Fix | Delete
</amp-analytics>
[454] Fix | Delete
<?php } }
[455] Fix | Delete
[456] Fix | Delete
[457] Fix | Delete
// Analytics support added for Adobe
[458] Fix | Delete
[459] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-adobe-switch')){
[460] Fix | Delete
$hostname = $ReportSuiteId =
[461] Fix | Delete
$hostname = ampforwp_get_setting('ampforwp-adobe-host');
[462] Fix | Delete
$subdomain = ampforwp_get_setting('ampforwp-adobe-subdomain');
[463] Fix | Delete
$type = ampforwp_get_setting('ampforwp-adobe-type');
[464] Fix | Delete
$ReportSuiteId = ampforwp_get_setting('ampforwp-adobe-reportsuiteid');
[465] Fix | Delete
[466] Fix | Delete
[467] Fix | Delete
if($type =='adobeanalytics_nativeConfig')
[468] Fix | Delete
{
[469] Fix | Delete
[470] Fix | Delete
$adobe_fields = array(
[471] Fix | Delete
"requests"=> array(
[472] Fix | Delete
'base'=>'https://${host}',
[473] Fix | Delete
'iframeMessage'=> '${base}/?ampforwpAnalytics=adobeNativeConfig&campaign=${queryParam(campaign)}&pageURL=${ampdocUrl}&ref=${documentReferrer}'
[474] Fix | Delete
),
[475] Fix | Delete
'vars' => array(
[476] Fix | Delete
'host'=> ampforwpremoveHttps($subdomain),
[477] Fix | Delete
),
[478] Fix | Delete
'extraUrlParams' => array(
[479] Fix | Delete
'pageType' =>'AMP'
[480] Fix | Delete
[481] Fix | Delete
),
[482] Fix | Delete
[483] Fix | Delete
);
[484] Fix | Delete
[485] Fix | Delete
$adobe_fields = apply_filters('ampforwp-adobe-analytics', $adobe_fields);?>
[486] Fix | Delete
[487] Fix | Delete
<amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="<?php echo $type;?>">
[488] Fix | Delete
[489] Fix | Delete
<script type="application/json">
[490] Fix | Delete
[491] Fix | Delete
<?php echo wp_json_encode( $adobe_fields,JSON_UNESCAPED_SLASHES); ?>
[492] Fix | Delete
[493] Fix | Delete
</script>
[494] Fix | Delete
[495] Fix | Delete
</amp-analytics>
[496] Fix | Delete
[497] Fix | Delete
<?php
[498] Fix | Delete
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function