Dear knowing,
i use piwik 1.12, a piwik.php and this code in my index.php and index.html
In CMS (index.php) sites all fine! But in simply html sites not show the provider from user! always show "Provider Yourhostingaccount" and the ip from my server....
Can anyone help me?? I think that is a bug in the piwik.php? Or not?
Here the piwik.php
Please help me.
So many thanks!
i use piwik 1.12, a piwik.php and this code in my index.php and index.html
<!-- Piwik --> <script type="text/javascript"> var _paq = _paq || []; _paq.push(["trackPageView"]); _paq.push(["enableLinkTracking"]); (function() { var u=(("https:" == document.location.protocol) ? "https" : "http") + "://mysite.com/"; _paq.push(["setTrackerUrl", u+"piwik.php"]); _paq.push(["setSiteId", "1"]); var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript"; g.defer=true; g.async=true; g.src=u+"piwik.php"; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Piwik Code -->
In CMS (index.php) sites all fine! But in simply html sites not show the provider from user! always show "Provider Yourhostingaccount" and the ip from my server....
Can anyone help me?? I think that is a bug in the piwik.php? Or not?
Here the piwik.php
<?php /** * Piwik - Open source web analytics * Piwik Proxy Hide URL * * @link [piwik.org] * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ // ----- // Important: read the instructions in README.md or at: // https://github.com/piwik/piwik/tree/master/misc/proxy-hide-piwik-url#piwik-proxy-hide-url // ----- // Edit the line below, and replace http://piwik-server.com/piwik/ // with your Piwik URL ending with a slash. // This URL will never be revealed to visitors or search engines. $PIWIK_URL = 'http://piwik.mysite.com/'; // Edit the line below, and replace xyz by the token_auth for the user "UserTrackingAPI" // which you created when you followed instructions above. $TOKEN_AUTH = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // Maximum time, in seconds, to wait for the Piwik server to return the 1*1 GIF $timeout = 5; // DO NOT MODIFY BELOW // --------------------------- // 1) PIWIK.JS PROXY: No _GET parameter, we serve the JS file if (empty($_GET)) { $modifiedSince = false; if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { $modifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE']; // strip any trailing data appended to header if (false !== ($semicolon = strpos($modifiedSince, ';'))) { $modifiedSince = strtotime(substr($modifiedSince, 0, $semicolon)); } } // Re-download the piwik.js once a day maximum $lastModified = time() - 86400; // set HTTP response headers header('Vary: Accept-Encoding'); // Returns 304 if not modified since if (!empty($modifiedSince) && $modifiedSince < $lastModified) { header(sprintf("%s 304 Not Modified", $_SERVER['SERVER_PROTOCOL'])); } else { header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); @header('Content-Type: application/javascript; charset=UTF-8'); if ($piwikJs = file_get_contents($PIWIK_URL . 'piwik.js')) { echo $piwikJs; } else { header($_SERVER['SERVER_PROTOCOL'] . '505 Internal server error'); } } exit; } // 2) PIWIK.PHP PROXY: GET parameters found, this is a tracking request, we redirect it to Piwik $url = sprintf("%spiwik.php?cip=%s&token_auth=%s&", $PIWIK_URL, @$_SERVER['REMOTE_ADDR'], $TOKEN_AUTH); foreach ($_GET as $key => $value) { $url .= $key . '=' . urlencode($value) . '&'; } header("Content-Type: image/gif"); $stream_options = array('http' => array( 'user_agent' => @$_SERVER['HTTP_USER_AGENT'], 'header' => sprintf("Accept-Language: %s%s\r\n", @str_replace(array("\n", "\t", "\r"), "", $_SERVER['HTTP_ACCEPT_LANGUAGE'])), 'timeout' => $timeout )); $ctx = stream_context_create($stream_options); echo file_get_contents($url, 0, $ctx);
Please help me.
So many thanks!