Tracking phone calls with Matomo

Hey there,

with I’m currently building a service for listening to podcasts via telephony. I already capture some statistics, but I think Matomo would be a great choice to give deeper understanding to the data.

These are my current ideas on how I would like to use it:

  • Use Pages to display navigation via phone keys (DTMF)
  • Use Actions for special triggered functionalities
  • Map landline prefixes to Geo coordinates
  • Use standard Duration count for call length

For reference: In Germany, every landline telephony number has a prefix, which indicates the caller destination city or region.

I’m already experienced in “faking” page visits, e.g. via a server middleware. But I’m not sure about how to give Matomo a location I already identified instead of using the GeoIP lookup provided by Matomo.

Also I’m not quite sure how Matomo determines the length of a visit. This should be as exact as possible and triggered by a hangup event within my call software.

Has anyone done something similar?

I’m looking forward to your ideas and suggestions!


Very interesting project!
I think that for locations, you should capture the prefix as visit custom dimension. Then instead of the GeoIP lookup, you’ll need to develop your own plugin, being inspired by the GeoIP plugin code… I think some database for such feature should be public somewhere, as for example my Samsung phone is able to tell me where a call comes from…
About the duration, you just have to send an event when the user hangs up. Matomo calculates the time between the first and last event. But be careful if a user do another call 1 or 2 minutes after having hung, the duration may take this new event as the last event of the previous “page”…

Hi Philippe, many thanks for your input, that already hints me into the right direction :+1:t3:

So tracking duration is straight forward, awesome! I think using the new_visit flag on each new call should do the trick for distinguishing between two successive calls.

I also took a quick glimpse into the geoip2 plugin, adapting it to phone numbers also seems quite doable in reasonable time. At least for Germany, the Bundesnetzagentur provides extensive CSV tables at, which should be a good starting point.