Using HTTP Api? Watch out when tracking outgoing links

Hello

If you are using the HTTP API (see https://developer.matomo.org/api-reference/tracking-api#optional-action-info-measure-page-view-outlink-download-site-search ), and would like to track outgoing links, then here is a tip:

The documentation in the link above says " * link β€” An external URL the user has opened. Used for tracking outlink clicks. We recommend to also set the url parameter to this same value."

However, the url parameter needs to be a URL that is allowed to be tracked. For example, if i am running matomo scripts on myDomain.com and want to track a click to β€œgoogle.com”, then the URL parameter should contain β€œmyDomain.com” and the β€œlink” can contain β€œgoogle.com”

Of course, this will need a http redirect, etc., which i am sure you will be doing if you are redirecting and tracking.

It took me a few minutes to enable debug and figure out what was going on

Hope this helps someone

1 Like