Angular 4 issue with integration of the Angular2Piwik npm package

I have a project that is build on Angular 4. I want to integrate Piwik tracking into my components.

I have found a number of deprecated packages that support Angular with Piwik and i ended up using the angular2piwik package.

I have followed the instructions for the section below

  • Initialize Piwik via Root Component
  • Include it in your application

    the only thing extra that i have added in this part was ‘, providers: [ConfigurePiwikTracker, UsePiwikTracker]’ in the providers because of the console error ‘No provider for ConfigurePiwikTracker!’

Exactly as they are written but when i try to load the app i get the folllowing errors in the chrome console when i try to access the component that i have added the tracking code

_paq.push() was used but Piwik tracker was not initialized before the piwik.js file was loaded. Make sure to configure the tracker via _paq.push before loading piwik.js. Alternatively, you can create a tracker via Piwik.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order. (2) [“setUserId”, “test-123”]

What might be wrong with this setup?


I can’t say anything about third-party-libraries, but maybe try out integrating piwik yourself.

You’ll probably want to follow this manual: