joernroeder / piwik-react-router

Piwik analytics component for react-router
https://www.npmjs.org/package/piwik-react-router
MIT License
61 stars 22 forks source link

Can't find variable: document #37

Closed RHinderiks closed 7 years ago

RHinderiks commented 7 years ago

Maybe i am using this plugin entirely wrong but i am trying to use it in a react native app. But when i add

var PiwikReactRouter = require('piwik-react-router');

var piwik = PiwikReactRouter({
      url: '127.0.0.1/piwik',
      siteId: 1
    });

It just results in a red page saying "Can't find variable: document"

joernroeder commented 7 years ago

Hey, thanks for trying out piwik-react-router! As far as i know you're the first one using it with react native #yeah and i didn't try it myself. document, the global root element in the browser is obviously not available in the native environment. I'll open another issue regarding a react native implementation but some projects on npm like https://www.npmjs.com/package/react-native-google-analytics-bridge are using iOS and Android specific modules which then talk with react native and i think restructuring and enhancing the module to provide a drop-in solution should be the goal here. Did you have a look at the official piwik SDKs for iOS and Android? https://github.com/piwik/piwik-sdk-ios https://github.com/piwik/piwik-sdk-android

I would love to see more infos how you're building the navigator etc. to get an idea how we could implement the integration.

RHinderiks commented 7 years ago

To be honest i'm only 2 weeks into react native and not really liking it. My biggest issue is that the out of the box components are very basic in options which is fine for a crud application but for every advanced thing i needed to either develop it myself (which isnt really an option if you're 2 weeks in with i tight shedule) or other people's plugins which don't seem to work well together and don't always have proper support. Also the native components have some weird options for example their listview has a reachBottom function but their scrollview doesnt (Which to me seems like a thing every scrollable component should have)

Anyway, i don't think i'm much of a help here. To answer your question on the navigator i needed some basic functions which don't seem to be inside the native component so i had to download a plugin for that too.

joernroeder commented 7 years ago

@RHinderiks oh that doesn't sound like a good foundation to build on. i just saw the react-native-piwik package on npm. did you try it?

RHinderiks commented 7 years ago

We actually changed to ionic, it may not be native but it has alot more features and seems more stable and since its javascript we can use piwik without any issues (hopefully :D)