简体   繁体   中英

how to use piwik javascript code in app.js on express

I want to use javascript code of piwik to track my website which is built on express. I had put my javascript code in app.js in express. But found error.

my javascript code is:-

               <script type="text/javascript">
             var _paq = _paq || [];
             _paq.push(["trackPageView"]);
           _paq.push(["enableLinkTracking"]);

       (function() {
           var u=(("https:" == document.location.protocol) ? "https" : "http") + "://localhost/piwik/";
        _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.js";   s.parentNode.insertBefore(g,s);
          })();
      </script>

You can't run the client-side code for Piwik directly on Node.js.

But there are specific Node clients that you can use instead:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM