We don't use the Matomo JS script but instead do some server-side tracking from .NET Core 3 to our self-hosted Matomo instance, which has worked without a hitch so far.
To track downloads, we set the download
property in the HTTP request to Matomo, but at the same time have set up a goal in Matomo that listens for URL contains downloadfile (case-insensitive)
.
A new download is tracked in both the Behaviour > Downloads report as well as as a goal conversion.
The new download is not tracked as a goal conversion but it is tracked in the Downloads report.
If we force the goal conversion in code, while still setting the download
property in the same HTTP request, the goal is tracked, however now the download is not added to the Downloads report anymore.
The download should be tracked for both, the Downloads report and the goal conversion.
I'm also pretty sure that this worked with an earlier version of Matomo when I originally set all of that up (unfortunately the Matomo installation history only shows 4.4.1, but we started with a 4.X version).
Is there no misspelling in the goal configuration? (e.g. whitespace in the test or in the file name...)
Maybe try with a condition that is always true (e.g. Matches pattern *
)
@hhhuut just to be sure, did you configure the goal to match when the visitor visits a certain URL or when he downloads a certain file?
Thanks for the quick answers.
Is there no misspelling in the goal configuration? (e.g. whitespace in the test or in the file name...)
Maybe try with a condition that is always true (e.g. Matches pattern*
)
No, there's no spelling mistakes. I also did what you suggested, which is change the goal-type to "Pattern regex: (.*)" which matches everything, and the goal was then triggered with every regular page visit EXCEPT where I also set the download
property in the HTTP request.
@hhhuut just to be sure, did you configure the goal to match when the visitor visits a certain URL or when he downloads a certain file?
It's set up to trigger when the visited URL contains the string downloadfile
(case-insensitive comparison, but I tried both).
The reason that we decided against using "Download a file" triggers is that the file is not downloaded directly from the webserver, but rather the webserver returns the URL of our CDN where the latest version of that file is, so the browser then downloads the latest version and uses the CDN for that.
@hhhuut Ok. But literally the request is tracked as a download in Matomo, right? Even if the url is on your server, Matomo can't match that as a visited URL if it's not tracked as a pageview I guess.
I'll try to detail the steps a little more:
When a user clicks "Download" on our website, the request goes to our own webserver, just as any other click does, where we run our Matomo client. We then extract some information from that request (like full url of the webserver action that is executing right now, referrer, useragent, etc.) and send that as a pageview request to our Matomo server.
After that, our webserver determines what the latest version of the requested file is, builds an appropriate file URL using our CDN and returns that back to the client in its HTTP response. This CDN file URL is NOT tracked in Matomo.
So to answer your question, the download action is a full pageview, using exactly the same amount of extracted information from the original HTTP request as any other pageview does in our system.
The only difference to other pageviews is that we mark the download action from our webserver (not the actual file download from the CDN mind you!) as a download for Matomo, so that it shows up in the Behaviour > Donwloads report.
However this difference seems to be preventing Matomo from converting visits to the download action to the appropriate goal.
Like I mentioned, if I do not mark the download action page visit as a download, Matomo manages to convert the goal. If I mark it however, Matomo doesn't manage to do that, and I'm pretty sure this wasn't always the case.
In both cases Matomo tracks the download correctly as a page view, meaning it shows up in the visits log, etc.
Ideally I'd like to have both, the Downloads report and the goal report, filled, without sending the same request twice or any other hacky solution like.
Can you share either the requests sent to the matomo server and/or the visits log?
This is the visits log when I mark the URL as a download (you can see that it has a specific icon).
This is the visits log when I don't mark the URL as a download. The icon is just a normal pageview now but the goal conversion tracker in Matomo managed to correctly fulfill the goal.
As you can see, the download is a part of the page navigation
Then your download tracking request (to MATOMO) seems not to be good...
Note: it is also possible to track manually the goal via another request... (idgoal
HTTP parameter)
see https://developer.matomo.org/api-reference/tracking-api
As you can see, the download is a part of the page navigation
Then your download tracking request (to MATOMO) seems not to be good...
As I mentioned in the beginning we don't use Matomo's javascript, we send all tracking requests from our webserver instead, which does not have any notion if you're technically/visually still on the same page or not. This way this looks in the visits log is totally fine for us.
Note: it is also possible to track manually the goal via another request... (
idgoal
HTTP parameter)
see https://developer.matomo.org/api-reference/tracking-api
I know, I'd like to avoid sending two requests however, since that's what the goal filter should be for.
It's set up to trigger when the visited URL contains the string downloadfile (case-insensitive comparison, but I tried both).
@hhhuut I feel @sgiehl question was maybe not answered clearly. What @sgiehl was asking is if in the goal configuration you have selected this option:
"Goal is triggered when visitors Download a file".
Just to double check we're talking about the same thing, is this one activated?
Sorry, thought I made that clear. No, the "Download a file" option is not selected, we use the "Visit a given URL" option.
@hhhuut This can't work when you are tracking DownloadFile
as a download and not as a pageview. You may need to change your goal definition.
I feel a little stupid now but changing the goal to "when visitors download a file" did the trick and we're tracking downloads as goal conversions as well now.
I still think it used to work with "Visit a given URL" a few months back, but I'm not going to complain now ^^
Thanks for all the help.