Hi, using old Matomo 3.6. Is there a way to show the entire url in the visitor log/report?
Using another analytics service and they show a “Direct Entry” the same way as Matomo however they show the entire url like this:
www.domain.com/products/Link~Goodwe~Inverter~5~Buy~GW5048D-ES.htm?gclid=xxxxxxetc
So even if it is a direct entry I know it is coming from my Google Advertising.
Whereas Matomo only shows:
www.domain.com/products/Link~Goodwe~Inverter~5~Buy~GW5048D-ES.htm
So I have no way to know where this click/visitor came from.
Maybe is there a setting or Javascript I can add?
Thanks,
Richard
Hello,
Good question, if you are using Matomo Tag Manager, maybe you could use a custom dimension which will be filled by the full referrer by using a javascript custom script (still in matomo tag manager).
1 Like
Thank you…I don’t use the Matomo Tag Manager…I manually added the event javascript to my elements like so:
onclick=“_paq.push([‘trackEvent’, ‘Share’, ‘Web’, ‘Test’]);”
which works really well.
I’m more thinking of adding some javascript to the Matomo code itself:
<!-- Matomo -->
<script type="text/javascript">
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//www.domain.com/japanese/matomo/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
To somehow get the entire url including the ?gclid=xxxxxxetc
part.
Thanks
sorry, my Matomo code got removed:
<script type="text/javascript">
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//www.domain.com/japanese/matomo/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
var _paq = _paq || [];
/* tracker methods like “setCustomDimension” should be called before “trackPageView” */
_paq.push([‘trackPageView’]);
_paq.push([‘enableLinkTracking’]);
(function() {
var u=“//www.domain.com/japanese/matomo/”;
_paq.push([‘setTrackerUrl’, u+‘piwik.php’]);
_paq.push([‘setSiteId’, ‘1’]);
var d=document, g=d.createElement(‘script’), s=d.getElementsByTagName(‘script’)[0];
g.type=‘text/javascript’; g.async=true; g.defer=true; g.src=u+‘piwik.js’; s.parentNode.insertBefore(g,s);
})();
Hi @RichardMatomo
You could do a little as suggested Ronan, by extracting the gclid into a custom dimension (or custom variable if not available in tour Matomo version):
Before the track page view event
var gclid;
function extractGclid(s) {
var extract = /^gclid=(.*)/i.exec(s);
if(extract) {
gclid = extract[1];
return true;
}
return false;
}
var search = /^\?(.*)/.exec(document.location.search) ;
if(search && search[1].split('&').find(extractGclid)) {
_paq.push(['setCustomDimension', 1, gclid]);
}
Another way is to accept gclid param in tracking URL, but the page report will be polluted by page URL doubloons… (just changing by gclid). Then update the config file in order to remove gclid
from url_query_parameter_to_exclude_from_url
.
1 Like
Hi Philippe…thank you very much for this…your code is working and I learned how to set custom dimensions…however, I would just like to have it as your “Another Way” suggestion to accept the gclid param in the tracking URL…and…I don’t really care about the value after the “gclid”…I basically just want to see in the visitor log:
“www.domain.com/products/Link~Goodwe~Inverter~5~Buy~GW5048D-ES.htm?gclid” instead of currently:
“www.domain.com/products/Link~Goodwe~Inverter~5~Buy~GW5048D-ES.htm”
Thanks,
Richard
Hi @RichardMatomo
You’ll have to update the Matomo configuration file:
But in this case, you’ll get the full gclid
in the page URL (and this will pollute reports)
I suggest either you update the config file and also clean the url from the gclid
value before tracking the page view: _paq.push(['setCustomUrl', urlCleanedFromGclidValue]);
Or (my preference) add campaign parameters to the tracking URL (also with _paq.push(['setCustomUrl', urlWithAdditionalMtmCampaign]);
. Eg. with '&mtm_campaign=Google%20Ad&mtm_kwd=' + gclidValue
Hi Philippe, I marked your first reply as a solution…as this would work for someone like me who is not so good in programming and has lots of visitors.
I only have about 20 max visitors per day.
Unfortunately all your other suggestions didn’t work or I just didn’t understand them and all the links you posted are just too hard for me.
However your advice to “update the Matomo configuration file” made me investigate the “Settings” > “Diagnostic” > “Config file” (again using old Matomo 3.6).
In that Setting there is a reference to “url_query_parameter_to_exclude_from_url”.
So I searched for that reference in “config.ini.php” however was not there.
Then I searched for that reference in “global.ini.php”(in the same folder as config.ini.php) and there was the reference and I just deleted the “gclid” from that reference.
And this works now, yes, I get all the values after the gclid but again with few visitors it is okay and I don’t really use the reports much anyway…I just want to know where they are coming from and what they are doing on my site(I use lots of Events).
Really thanks again for all your time and help,
Richard