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

Porperty 'location' doesn't exist #48

Open
Jackyang-SS opened this issue Sep 16, 2022 · 4 comments
Open

Porperty 'location' doesn't exist #48

Jackyang-SS opened this issue Sep 16, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@Jackyang-SS
Copy link

Versions

react-native: 0.66
plausible-tracker: 0.3.8

Describe the bug

When I call the function "trackEvent" and "trackPageview", android and ios will show the error like below:

ERROR ReferenceError: Property 'location' doesn't exist

This error is located at:
in App
in RCTView (at View.js:32)
in View (at AppContainer.js:92)
in RCTView (at View.js:32)
in View (at AppContainer.js:119)
in AppContainer (at renderApplication.js:43)
in test(RootComponent) (at renderApplication.js:60), js engine: hermes

Anyone met this problem and how to solve it ?

@Jackyang-SS Jackyang-SS added the bug Something isn't working label Sep 16, 2022
@Jackyang-SS
Copy link
Author

I manually changed something in the tracker.js like set status value to url which used the "location" (where the errors come from), then it changed to 'document' is not exist. so I did try to previous version, the previous versions are all the same like this version ? Any solution and any one how to use it successfully ?

@chohra-med
Copy link

Facing the same issue with RN0.71.6, and plausible-tracker:0.3.8

@Daniel15
Copy link

It looks like this library is only built for usage in a browser at the moment.

@codeserk
Copy link

codeserk commented Nov 24, 2024

;(globalThis as any).window.location = { href: '', domain: '' }
;(globalThis as any).window.document = { href: '' }
;(globalThis as any).window.innerWidth = deviceWidth

in case it's useful to anyone, I was able to make it work using this BIG HACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants