So that the name of the product was downloaded from the page code and was auto-injected into Even GA.
I created this code:
Code: Select all
<?php
function w_callback($b){
$what = $on = array();
$what_r = $on_r = array();
preg_match_all('~<span class="Tytul">([^<]*)</span>~Usmi', $b, $dane_wejsciowe_nazwa_dopasowania);
foreach ($dane_wejsciowe_nazwa_dopasowania[1] as $key) {
$what_arr[] .= 'class="Offer">';
$on_arr[] .= 'itemscope="" itemtype="http://schema.org/Offer" onclick="ga(\'send\', \'event\', \''.$_SERVER['REQUEST_URI'].'\', \''.$key.'\');" class="Offer">';
}
$b = str_replace($what,$on,$b);
$b = preg_replace($what_r,$on_r,$b);
$b = str_replace($what_arr, $on_arr, $b);
return $b;
}
if(stristr($_SERVER['REQUEST_URI'],'wp-admin')===false) ob_start('w_callback');
?>The name of the product is taken and thrown into place, but everywhere is generated the same.

Online: http://seowars.cba.pl/2017/05/26/witaj-swiecie/