Error setTrackerURL is registered more than once

My angular 8 SPA is branded for 2 programs i want to enable tracking on. I am getting error “The method setTrackerUrl is registered more than once in ‘_paq’ variable”. Here is the code in my app to enable matomo tracking :

//branding can be brand1 or brand2
int matomoSiteId = getSiteId(<“branding”>);
if(matomoSiteId > 0)
this.matomoInjector.init(environment.matomoUrl, matomoSiteId);