tags * @var $idsite - id of the site to be tracked, as set up in Piwik * **/ function piwik_tag($title, $idsite=1) { $request = array(); # idsite $request['idsite'] = $idsite; # url - Requested URL if ($_SERVER['SERVER_PORT'] == 80) { $request['url'] = 'http%3A%2F%2F' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; } else { $request['url'] = 'https%3A%2F%2F' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; } # cookie - Are cookies enabled? if (isset($_SERVER['HTTP_COOKIE']) and $_SERVER['HTTP_COOKIE'] != '') { $request['cookie'] = 1; } else { $request['cookie'] = 0; # or possibly not set? } # urlref - Referrer $request['urlref'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; # h, d, s - hours, days seconds list($request['d'],$request['h'],$request['s']) = explode(',',date('d,g,s',$_SERVER['REQUEST_TIME'])); # rand - random number - quick 17 precision random number. $request['rand'] = '0.' . mt_rand(0,99999999999999999); # action_name $request['action_name'] = $title; # rec - record? 1 by default $request['rec'] = 1; $request_string = http_build_query($request); ?>