matomo icon indicating copy to clipboard operation
matomo copied to clipboard

Page Overlay doesn't seem to work when tracking code Matomo URL is different from Matomo GUI URL (e.g. proxy configuration)

Open peterbo opened this issue 4 years ago • 12 comments

Expected Behavior

When opening the Page Overlay feature for a given URL, the Page Overlay should open and display the corresponding numbers and overlay data for a given page.

Current Behavior

Currently, if the Matomo tracking URL is different from the Matomo GUI URL (e.g. in proxy environments), Overlay does open, but keeps the loading screen in the left frame (no data will be loaded), and no overlay data is shown in the website view frame.

Possible Solution

Steps to Reproduce (for Bugs)

  1. Have the Matomo Tracking URL implemented in the website via URL A
  2. Have the Matomo Reporting GUI accessible via URL B
  3. try to open page overlay

Your Environment

  • Matomo Version: 4.4.1
  • PHP Version: ?
  • Server Operating System: ?
  • Additionally installed plugins: -
  • Browser: Firefox
  • Operating System: Windows 10

peterbo avatar Nov 11 '21 03:11 peterbo

@peterbo could you maybe check if there are failing requests when opening the overlay? Maybe there are some CORS headers in place that are causing issues?

sgiehl avatar Nov 11 '21 10:11 sgiehl

@peterbo Other possible bug source: the site is in HTTP and Matomo in HTTPS. Your browser won't allow this (it won't allow display an HTTP frame in an HTTPS page)...

heurteph-ei avatar Nov 16 '21 08:11 heurteph-ei

I can confirm this bug. Manually overriding pPiwikRoot is fixing the issue, as pPiwikRoot get the domain of URL A instead of URL B. Still present in 4.6.2. (all sites in HTTPS)

mikkeschiren avatar Feb 01 '22 11:02 mikkeschiren

I have been looking into this today again. We would really need to implement a solution where the "tracker domain" like this plugin from @mikkeschiren does https://github.com/digitalist-se/TrackerDomain and use that variable to handle this. I will for now create a patch for the Overlay plugin to make our environment work with a separate tracker domain.
I really think this should be part of core in the end (both the TrackerDomain and the changes in the Overlay plugin and potentially a lot of other plugins that might have similar issues.

tomper00 avatar Mar 24 '22 13:03 tomper00

Started to dig into this again, but having a hard time figuring out where pPiwikRoot URL is coming from?

mikkeschiren avatar Feb 02 '23 21:02 mikkeschiren

@mikkeschiren It is passed through from the tracking code. In piwik.js the overlay scripts are initiated here: https://github.com/matomo-org/matomo/blob/4.x-dev/js/piwik.js#L6588

It also provides the configTrackerUrl as parameter, which is in the end used as pPiwikRoot.

sgiehl avatar Feb 03 '23 11:02 sgiehl

Why is the main reason behind that the code for the display of the Overlay is in the piwik.js? As that mainly is for tracking, should code not used for tracking, be part of that file? I am sure there is a good reason, but I just doesn't understand it :)

mikkeschiren avatar Feb 09 '23 22:02 mikkeschiren

@mikkeschiren Haven't looked in detail, but I think it wouldn't be possible to inject custom javascript into a website shown in an iframe. As the tracking code is always included we use it to load additional javascript for the overlay features.

sgiehl avatar Feb 13 '23 08:02 sgiehl

Ah, that makes sense.

mikkeschiren avatar Feb 20 '23 16:02 mikkeschiren

Are there any updates regarding this issue ? (Matomo support asked me to comment here :sweat_smile: )

You are most welcome to comment on the GitHub issue as the more requests we get for this to be resolved, the more priority is given to the issue.

John98Zakaria avatar May 21 '24 13:05 John98Zakaria

+1

jannikschaper avatar May 21 '24 14:05 jannikschaper

Same issue for another customer. I can see the Page Overlay feature is trying to display the customer's site in an iFrame but the site does not allow cross origin requests... image

9joshua avatar Jun 16 '24 21:06 9joshua