Checking if Piwik tracker exists

I have implemented Piwik for the users of my website, and tracking is working well. But is there any way I can check via the API, if the tracker exists for a given site, and if data has been recorded for it?

This issue does not happen for sites where a SiteID has not been generated, however, if a user has requested their tracking code, but not added it into the site yet, I cannot find a way to handle this case. The API will return data (All 0, but still no way to differentiate it from a site with no visits yet) since the row exists, but the tracker itself is not present, so the data will continue to remain 0.

As of now my workaround for this is to check if the code physically exists on the site using a cURL command. But I would be much happier if there was an API based solution I can use here.

Thanks in advance!

I am not sure if it is possible to do what you want.

Piwik has no way of knowing if someone embeds a tracking code until the first person visits the page, the tracking code is executed and data is sent to piwik.
If no data is sent, piwik can’t know that the tracking code is embedded.

So in my option there are only the two solutions you list (check if there is data or directly check tracking code via curl or similar)

Ah I figured as much. But just to be sure, there is no way to check if data exists either, right? (Because data not existing and data being filled with 0s are not exactly the same thing…).

I haven’t used the api much, so I am not sure if this is correct, but I’d assume you could use Live.getVisitorProfile or Live.getMostRecentVisitorId to check if there were visitors.