@mattab opened this Issue on April 25th 2019 Member

The goal of this issue is to collect feedback around how people track Cordova/ionic mobile apps using Matomo.

One of the limitations is that cookies may not be supported in these apps, so if this is confirmed, tracking accuracy may be affected as explained in this faq (impact of tracking without cookies)

Maybe the solution to this issue could involve writing a Cordova / ionic plugin for Matomo tracking, like it exists for others (GA, Mixpanel, etc.). Or maybe we could make our own JavaScript tracker work by using Local storage when cookies are not available.

Would also be good to create a new FAQ about Cordova / ionic analytics with Matomo to let people know when they search (we had a similar one about phonegap tracking).

Be great if you can comment in this issue with your feedback measuring a Cordova / ionic app with Matomo :+1:

@GitFr33 commented on April 26th 2019

I have had very good results using Matomo for analytics in Cordova Apps.

The integration has been quite straight-forward and I've had no issues with lack of cookies. I did have to set up my own do-not-track option using localstorage.

One area of Cordova app analytics that is a challenge with Matomo is new user attribution. I have not managed to track where new app installs come from using matomo.

@mattab commented on May 17th 2019 Member

Thanks for the feedback @GitFr33 :+1:

@mattab commented on May 17th 2019 Member
@APalau82 commented on June 24th 2019

Hey

Did anyone succeed in implementing Matomo into Ionic app ?

I tried to follow the instructions with the 'ngx-matomo' package but the tracker did not separate the pages. I had every time the same page tracked, with the title of my 'index.html' page title...

Please any help or example of Matomo integration with Ionic would be really appreciated

@GitFr33 commented on June 24th 2019

I don't know about ionic and whether it has a build in method for handling pseudo page load type navigation but using Matomo with cordova apps that are a single (index.html) file with asynchronous javascript navigation I used the trackPageView() with a custom page title to set retentive page view data.

@APalau82 commented on June 26th 2019

I don't know about ionic and whether it has a build in method for handling pseudo page load type navigation but using Matomo with cordova apps that are a single (index.html) file with asynchronous javascript navigation I used the trackPageView() with a custom page title to set retentive page view data.

Thanks. In the same idea I used the matomo tracker component with the ngx-matomo package.

// component
import { Component } from '<a class='mention' href='https://github.com/angular'>@angular</a>/core';
import { MatomoTracker } from 'ngx-matomo';

<a class='mention' href='https://github.com/Component'>@Component</a>({
  selector: 'app',
  template: `<router-outlet></router-outlet>`
})
export class AppComponent {
  constructor(
    private matomoTracker: MatomoTracker
  ) { }

  ngOnInit() {
    this.matomoTracker.setUserId('UserId');
    this.matomoTracker.setDocumentTitle('ngx-Matomo Test');
  }
}

But never get the tracker on my dashboard. I never saw the ngx-Matomo Test page title in my stats.

@GitFr33 commented on June 28th 2019

I'm not sure but I believe that setDocumentTitle() has to be called before trackPageView(), have you confirmed that you are calling them in the correct sequence?
Also, you could try specifying the page title as the argument of trackPageView([customTitle]) i nstead of using setDocumentTitle which is how I got it working.

@jorisd89 commented on July 14th 2019

Just set up Matomo in my Ionic app, and it works pretty good.

I followed the instructions of the readme of ngx-matomo. At every page of my app I added the following to ngOnInit():
ngOnInit() { this.matomoTracker.trackPageView('PageTitle'); }
Update: set this in ionViewDidLoad() for better accuracy.

Pageviews show up in my Matomo dashboard, although the url is the same for all pageviews (http://localhost/). The report at Behaviour > Page titles gives an overview of all viewed pages which can be further analysed.

For some specific actions in my app I'm also tracking events like explained in the readme:
this.matomoTracker.trackEvent('Category', 'Action', 'Name', NumValue);

The missing cookies doesn't seem to be much of a problem, but I'll have to test this more when my app is live.

I'm not sure but I believe that setDocumentTitle() has to be called before trackPageView(), have you confirmed that you are calling them in the correct sequence?

I'm not using setDocumentTitle() and it works, so I don't think it's needed at all.

Hope this helps anyone. It may not be the full 100% integration, but it gives me more than enough data to analyse.

Powered by GitHub Issue Mirror