Get selected website url


#1

Hi,

does anybody know how to get the url of the currently selected website from within a plugin?
Is there any method or global variable?

Regards,
Sandro


(Matthieu Aubry) #2

Hi Sandro

Yes the selected Site URL is available in a global Javascript variable: piwik.siteMainUrl

maybe you need it server side in PHP? in your controller for example you can call $this->site->getMainUrl()


#3

Hey Matt,

this works, thank you!

Regards,
Sandro