Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setCustomUrl in Cordova App on IOS #15470

Closed
werishi opened this issue Jan 27, 2020 · 5 comments
Closed

setCustomUrl in Cordova App on IOS #15470

werishi opened this issue Jan 27, 2020 · 5 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@werishi
Copy link

werishi commented Jan 27, 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
Copy link
Member

tsteur commented Jan 27, 2020

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

@tsteur tsteur closed this as completed Jan 27, 2020
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Jan 27, 2020
@werishi
Copy link
Author

werishi commented Jan 28, 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
Copy link
Member

tsteur commented Jan 28, 2020

@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
Copy link
Author

werishi commented Jan 29, 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
Copy link
Member

tsteur commented Jan 29, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

2 participants