@anonymous-piwik-user opened this Issue on March 9th 2010

Hi there,
i need the id of an website (piwik_idsite = X) - Is its possible to commit the url of an project and get the piwik_idsite back?


@robocoder commented on March 9th 2010 Contributor

In future, please rephrase your inquiries as a feature request, or post your question on the forum. In the meantime, I have marked this as invalid.

To answer your question, when you add a site via the API, it returns the idsite. There's currently no getIdFromSiteUrl method in the API.

If you submit a patch to implement this method, we'll review it. It's a complex operation though, so here's a tip: (pseudo-coded)

function getIdFromSiteUrl( $url ) {
    remove trailing slash on $url

    select idsite from site where main_url = '$url';
    if no match {
        select idsite from site_url where url = '$url'

    if match {
        check user has view access to idsite
        return idsite

    return ''
@robocoder commented on March 31st 2010 Contributor

see #1261

This Issue was closed on March 31st 2010
Powered by GitHub Issue Mirror