matomo-org / tag-manager

Free Open Source Matomo Tag Manager - A simple way to manage and maintain all of your (third-party) tags on your website.
https://matomo.org
GNU General Public License v3.0
168 stars 57 forks source link

Wrong URL in Matomo after moving site to subdomain #802

Open diginote opened 3 weeks ago

diginote commented 3 weeks ago

Hello,

we started tracking in matomo tag manager for sites on a domain without a ‘www.’ subdomain (e.g. example.com). Later, all pages had to move to the subdomain ‘www.’ (e.g. www.example.com). Unfortunately, the ‘www.’ is still not listed in the visits in Matomo. Have we forgotten to update something?

snake14 commented 3 weeks ago

Hi @diginote . Thank you for taking the time to create this issue. I'm sorry to hear that you're experiencing complications. Is the issue that the visits aren't being tracked at all or that the subdomain isn't showing up in the visits log?

If the issue is that the visits are being filtered out and not tracked due to the subdomain, you probably want to check the trigger that is assigned to your Matomo Analytics tag and make sure that it's not filtering by domain.

diginote commented 3 weeks ago

Hi @snake14. The visits are tracked but the tooltip shows the old domain (without the www. subdomain). I was expecting the www. to be included in the url after moving to the new domain.

snake14 commented 3 weeks ago

Hi @diginote . I'm glad that the requests are being tracked. It's odd that it's not showing the URL that you are expecting. I'm pretty sure that Matomo is supposed to show the full URL, including protocol like https. Does your web server (Apache, NGINX, Tomcat, ...) use a wildcard and direct all subdomains to the same domain? Maybe the www is being removed before the tracking request is sent to Matomo. You might watch the Network tab in your browser's dev tools to see what URL is sent when tracking requests are sent to your Matomo server. Like this example request in my test site: image

AltamashShaikh commented 3 weeks ago

@snake14 @diginote I think that is expected, due to how the URLs are stored under log_action table, @sgiehl Correct me if I am wrong

diginote commented 3 weeks ago

Hi. I try to visualize my problem with an example:

This is my example request: https://my.matomo.com/js/?action_name=StartPage&idsite=10&rec=1&r=243754&h=7&m=14&s=58&url=https://www.example.com/start&_id=&_idn=1&send_image=0&_refts=0&dimension1=1&dimension2=1&dimension3=de&pv_id=ubC56s&pf_net=23&pf_srv=1&pf_tfr=18&pf_dm1=97&uadata={}&pdf=1&qt=0&realp=0&wma=0&fla=0&java=0&ag=0&cookie=1&res=1878x1149

Before moving to the www. subdomain the url was https://example.com. Now we are moved to the www. sudomain, the new domain is like in the request https://**www**.example.com. However, I do not see the change of domain in Matomo.

grafik

AltamashShaikh commented 3 weeks ago

@diginote We checked internally and that's expected all urls with and without www. are handled as same and hence you see it without www.

diginote commented 2 weeks ago

OK, but sometimes the »www.« subdomain is present but why? It also confuses our matomo users because we always redirect non www.... calls to the www... calls. Is there somewhere in matomo a way to configure that the "www." sudomain is always displayed when this is called?

atom-box commented 1 week ago

Hi @diginote Maybe check that your domain/subdomain are not listed in Matomo interface >> ⚙️ >> Measurables >> Manage >> edit-pencil-icon >> "urls"

Matomo uses that setting to remove the domain from the path. If you list nothing there, Matomo usually shows the full path. (If you leave it blank, Matomo seems to repopulate it, so confirm that it saved correctly. My workaround for that: I ended up saving a dummy address there to prevent Matomo from autopopulating that field.)

diginote commented 5 days ago

@atom-box Thanks for the advice. I have checked the options you mentioned. The domains were not listed in the measurables. Although I then add the urls (with and without www subdomain) to the measurables in the UI, only the www subdomain is removed. The following main domain with the path is not removed. At the moment I don't understand how this works.