donni106 / matomo-tracker-react-native

Stand alone library for using Matomo tracking in React Native and Expo projects.
MIT License
47 stars 15 forks source link

Question about setup #12

Closed georgibakken closed 2 years ago

georgibakken commented 2 years ago

Describe the bug I have created a new website in Matomo, which has the same url as our landing page. The landing page has it's own website in Matomo, as I don't want to merge landing page analytics with app events. Can I do this?

After installing and setting up Matomo in my app, using http://koermit.dk as baseUrl and the id of the website, I get the following error:

Matomo tracking is not sent: https://www.koermit.dk/matomo.php Object {
  "body": "idsite=2&rec=1&apiv=1&uid=&send_image=0&action_name=App / start",
  "headers": Object {
    "Accept": "application/json",
    "Accept-Language": undefined,
    "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
  },
  "method": "POST",
}

Matomo tracking error:, [Error]
at node_modules/matomo-tracker-react-native/src/MatomoTracker.js:197:8 in fetch.then._catch$argument_0

How do I get to see what error it is? What about Matomo.php in the end of the base url, do I have to do anything on my landing page or the domain? Could the domain be in theory anything as long as it matches the website in Matomo? What if my app doesn't have a url? When writing this I thought, do I need a tracking code implemented on my landing page for this to work ? I tried swapping the id to the one website in Matomo that has a tracking code, but no difference it seems.

Affected code lines if helpful Where is the problem?

    useEffect(() => {
        trackAppStart();
    }, []);
georgibakken commented 2 years ago

I do get this when starting the app:

Matomo tracking is enabled for: Object {
  "siteId": 2,
  "trackerUrl": "https://www.koermit.dk/matomo.php",
  "userId": undefined,
}
donni106 commented 2 years ago

Hello again @georgibakken, the urlBase or trackerUrl need to be the page your Matomo instance is hosted at. I cannot reach anything at http://koermit.dk. What is the url of your Matomo where you log in to see analytics?

georgibakken commented 2 years ago

Thanks @donni106 ! that explains it. It's http://koermit.matomo.cloud and now I can send actions.

Matomo tracking is sent: https://koermit.matomo.cloud/matomo.php Object {
  "body": "idsite=2&rec=1&apiv=1&uid=&send_image=0&action_name=Screen / Profile",
  "headers": Object {
    "Accept": "application/json",
    "Accept-Language": undefined,
    "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
  },
  "method": "POST",
}

Do you know if it usually takes some time before it pops up in my Matomo instance? It doesn't seem to be registered there yet

georgibakken commented 2 years ago

I can see the action has arrived. thanks for the help!

georgibakken commented 2 years ago

Actually the screen views don't seem to be under Pages in matomo, however I can see them in real time visits: image

donni106 commented 2 years ago

How would you pages expect to behave, as there are no real pages on mobile? This term comes from the web base of Matomo. Could you find some API references that would result in a way you think of?

georgibakken commented 2 years ago

That is true and it makes sense. It was mostly from this line in matomos documentation.

The Screen Views metric in Google Analytics will be imported and used as the Pageviews metric in matomo. The Screens reports will be imported into the Page Titles reports in Matomo. https://matomo.org/faq/general/running-the-google-analytics-import/

It gave me the impression that screen view in google analytics was similar to the screen view here, thus becoming a page in matomo

georgibakken commented 2 years ago

Looks like they do show up in pages, it just probably takes some time. Ill close this again, thank you for all the help!