Home  >  Article  >  Backend Development  >  javascript - Can the var u = "installed url" in the piwik tracking code be replaced with an IP address?

javascript - Can the var u = "installed url" in the piwik tracking code be replaced with an IP address?

WBOY
WBOYOriginal
2016-10-12 10:04:09882browse

I want to replace the url with the IP address in piwik’s tracking code to save the step of parsing

<code><!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//linlin.ngrok.com/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', '11']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<noscript><p><img src="//linlin.ngrok.com/piwik.php?idsite=11" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code --></code>

But changing var u in the code to the corresponding IP cannot be traced. I don’t quite understand. Do I need to modify any configuration of piwik?

Reply content:

I want to replace the url with the IP address in piwik’s tracking code to save the step of parsing

<code><!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//linlin.ngrok.com/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', '11']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<noscript><p><img src="//linlin.ngrok.com/piwik.php?idsite=11" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code --></code>

But changing var u in the code to the corresponding IP cannot be traced. I don’t quite understand. Do I need to modify any configuration of piwik?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn