@werishi opened this Issue on January 27th 2020

Hello

i have an issue with the behavior of setCustomUrl
if i write
track.push(["setCustomUrl", 'https://example.com/newpagename']);
i will get "example.com/https://example.com/newpagename"

so he doesnt overwrite the domain. only the path

yeah i could just use: track.push(["setCustomUrl", 'newpagename'])

but the problem is, if i use this on an ios device i get another url

file://var/container/Bundle......//https://example.com/newpagename

i need Webapp and Cordova App to track the same url

Maybe you can give me a hint.

Have a nice Week

@tsteur commented on January 27th 2020 Member

Maybe have a look at https://github.com/matomo-org/matomo/issues/14375 (maybe look more into page titles from what I see there) and https://matomo.org/faq/how-to/faq_33772/

@werishi commented on January 28th 2020

Hi

i use setDocumentTitle in addition to setCustomUrl. setDocumentTitle works fine, but. doesnt solve my problem, its another data record. I dont need Cookies and the functions dependent on it.

the Url behind setCurrentUrl is used to create a root structure in the matomo "page behavior" view.

First of all URI = scheme:[//authority]path[?query][#fragment]
setCurrentUrl should be called: setCurrentPath or do what it should. or am i missing something vital?

there musst be a way to overwrite the "authority"

@tsteur commented on January 28th 2020 Member

@werishi looking at the code... when you set _paq.push(["setCustomUrl", 'https://example.com/newpagename']); Matomo should not change that value. Are you using our JS tracker directly or some package for this?

@werishi commented on January 29th 2020

i use it directly insite my ember framework.

`setDefaults(){
window._paq = window._paq || [];

let url = 'https://'+ENV.APP.matomo.host+'/matomo';

window._paq.push(['setTrackerUrl', url+'.php']);
window._paq.push(['setSiteId', '1']);
window._paq.push();
let d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=url+'.js'; s.parentNode.insertBefore(g,s);

//Device
window._paq.push(['setCustomDimension', 1 , ENV.platform]);
//settings
if (this.isDisableCookies) {
  window._paq.push(["disableCookies"]);
}

},`

later i fill an array,

track.push(["setDocumentTitle", title]);
track.push(["setCustomUrl", customUrl]);

if the device is online and is rdy to send i do:

track.forEach(function(e){
        window._paq.push(e);
});

these are just example out of the code.

he is sending alle commands, i just have problems with setCustomUrl

i logged the forEach, and the parameters inside are correct.

@tsteur commented on January 29th 2020 Member

I've just tested this locally and this should work. Is the title working correctly for you? Maybe also double check the method is executed before calling trackPageView. Is there otherwise maybe any way you can debug this issue? So far it doesn't really look like an issue on our side.

This Issue was closed on January 27th 2020
Powered by GitHub Issue Mirror