Closed (fixed)
Project:
Matomo Analytics
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Jun 2018 at 21:46 UTC
Updated:
24 May 2023 at 13:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
hass commentedComment #3
hass commentedPlease share a patch.
Comment #4
pefferen commentedPossibly the data layer module is usefull within this context https://www.drupal.org/project/dataLayer
Comment #5
ricovandevin commentedI will give this a try.
Comment #7
ricovandevin commentedAttaching patch file from merge request opened in #6.
Comment #8
ricovandevin commentedComment #10
ricovandevin commentedJust updated the patch format.
Comment #11
ricovandevin commentedReroll...
Comment #12
grimreaperHello,
From what I see in the linked documentation page https://developer.matomo.org/guides/tagmanager/integration-plugin, and I suppose it is like Google Tag Manager https://www.drupal.org/project/google_tag, you can have multiple tag containers per website.
So I think it should be a dedicated config entities to be able to instanciate as many containers as you want.
And maybe it should be a sub-module or separate project.
Comment #13
somersoft commentedRerolled patch #11 so that it can be applied to 1.14 tag
Comment #15
stborchertHey.
I've created another merge request using config entities for the containers as suggested by @Grimreaper.
Comment #17
zcht commentedThanks for the patch #16, works great, the submodule installs, configures, tag manager in matomo functional. tags, triggers and events are detected correctly. tested with drupal 9.2.x and matomo 4.6.2
RTBC ++
Comment #18
zcht commentedLast update of the patch unfortunately breaks the function of the submodule because in the path /js is missing.
It is not generic in that case: Drupal Matomo configuration asks for the base directory, Matomo itself in Tag Manager settings has the following as a hint at the destination field.
Saving the Matomo configuration under Drupal does not happen, the following is displayed:
The validation of "https://domain.tld/js/matomo.php" failed with an exception "Client error: `GET https://domain.tld/js/matomo.php` resulted in a `404 Not Found` response: <html> <head><title>404 Not Found</title></head> <body> <center><h1>404 Not Found</h1></center> <hr><center>nginx</c (truncated...) " (HTTP code 404).In the Matomo documentation a snippet example is brought, there the /js is also included: https://developer.matomo.org/guides/tagmanager/integration-plugin
I have a self hosted Matomo instance, so there the path syntax with /js is expected, with a cloud Matomo this is apparently not needed.
There remain as two options with the current state of the patch:
Variant 1. Set the path to the Matomo instance via settings.php:
$config['matomo.settings']['url_https'] = 'https://domain.tld/js';Variant 2. URL rewrite on the server to insert a /js for self hosted instance.
I think better would be here, an option field: as default is self hosted Matomo selected, as a second variant Cloud-Matomo where then the URL is output without /js
Comment #19
grimreaperHello,
After reading quickly the last comment, is it related to #3130324: Use "js/" instead of "matomo.js"?
Comment #20
stborchert@Grimreaper Yes, I think the problem here is strongly related to #3130324: Use "js/" instead of "matomo.js". Self-hosted versions of Matomo required the path including "/js" while the cloud-hosted version doesn't use it in its paths.
The latest version of my merge request contains a new setting (unfortunately without an UI) that allows you to set a custom path that is appended to the configured URL (e.g. "/js/").
Comment #21
dydave commentedAdding related ticket.
Thanks a lot for the work on this new feature.
Comment #22
grimreaperComment #23
grimreaper@stborchert,
Thanks for the MR.
Only code organisation comments.
I will test the MR.
Comment #24
grimreaperIt is working great! (although not tested with Matomo Cloud)
I will try to add a form to be able to administer the new setting.
And fix code review comments.
Comment #25
grimreaperForm to administer the setting done. I have also done some code quality tool inspection.
Only 2 code review comments remaining!
Thanks for your feedbacks
Comment #26
grimreaperHi,
Thanks @stBorchert for the reply in my code review.
Can you please reply to my reply so I can make the last adjustment and merge it?
Also do not hesitate to post a comment after doing code review because code review comments/new commits pushed do not trigger a notification to people following issues.
Comment #27
grimreaperThanks for the reply.
I will also do https://www.drupal.org/node/3201242
Comment #28
grimreaperFinally there is nothing to do with this core change record because it only concerns content entities.
Pushing last commit. I will do a manual merge and will redo the commit for proper credit attribution.
Comment #30
grimreaperMerged.
Thanks everyone!
Comment #34
grimreaperHello,
In #3267827: Matomo Tag Manager support Matomo cloud, I will convert container ID into container URL for easier usage of either self hosted or cloud Matomo versions.
Feedbacks welcomed!
Waiting one week before merging.
Comment #36
noopal commentedHi can you provide screenshot of which URL?
I have the container ID but dont know where to find URL? Thanks