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

Inform if Matomo Tag Manager container tracking code is not on the page #773

Open Chardonneaur opened 3 months ago

Chardonneaur commented 3 months ago

Hi team, It happens sometimes that some clients do not understand why their Matomo Tag Manager configuration is not working. One of the reason is that sometimes they just do not understand that a new tracking code (so to say the container) has to be added to the page. --> Cannot we create a feature which would indicate that the container tracking code is not on the page?

snake14 commented 3 months ago

Hi @Chardonneaur . Thank you for taking the time to create this issue. Are you thinking that we inspect the URL configured for the measurable and see if the container JS is loaded on the page? Or were you thinking allow the customer to test any page by typing a URL into an input?

This could potentially be done in conjunction with #577

AltamashShaikh commented 3 months ago

Hi @Chardonneaur . Thank you for taking the time to create this issue. Are you thinking that we inspect the URL configured for the measurable and see if the container JS is loaded on the page? Or were you thinking allow the customer to test any page by typing a URL into an input?

This could potentially be done in conjunction with #577

@snake14 We have a way to check if JS code is installed on a website on no-data page, can we leverage that ?

snake14 commented 3 months ago

@snake14 We have a way to check if JS code is installed on a website on no-data page, can we leverage that ?

@AltamashShaikh Possibly. The no-data page doesn't explicitly check if the JS code snippet is installed, but it does check if the MTM code is executing and sending tracking requests back to the right Matomo instance. We would have to adjust the wording of the success message if we want to use the component outside of the no-data screen though: image

AltamashShaikh commented 3 months ago

@Chardonneaur Something like above will do ? The user would have to enter the URL and check if the tracking code is installed or not, the placement of this input box is something we need to decide

Chardonneaur commented 3 months ago

Thank you, to me, it is "Are you thinking that we inspect the URL configured for the measurable and see if the container JS is loaded on the page?" because that's the real thing. Users should be warned/informed, that the Matomo Tag Manager cannot collect the data if no container is on the page.

AltamashShaikh commented 3 months ago

@Chardonneaur The Q is when should we do this and where should we show an alert, a background task is not possible as it requires opening the URL in browser to verify, to do in background we would require node installed on server which would open the url in some headless browser and verify if its installed or not.