-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Allow usage of analytics adapter #2327
Allow usage of analytics adapter #2327
Conversation
response: {} | ||
}); | ||
function handlePost(req) { | ||
const analyticsController = req.config.analyticsController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually we try not to forward express request directly to the controllers, and be a bit more explicit
HI @deashay, thanks for the PR. Do you think the adapter could adopt |
Also, I'd wrap the adapter call inside a promise to catch errors and exceptions without forwarding to the client as I'm not sure how the SDK handle errors on thé analytics PoV |
@deashay updated the pull request. |
@flovilmart could you take a look now? |
Current coverage is 91.76%
|
Looks neat! Thanks for taking that up! |
Hi guys, I'm looking for a Parse Analytics replacement. Currently, Parse Server responds 200 OK with {} body to Analytics requests (AppOpened or custom event ones). @deashay provided a default Analytics Adapter. Has anyone started to work on adapters specific to Google Analytics or Mixpanel ? I didn't find anything. |
@fcoufour I'm no longer working on this project, but I can share my changes with you, I've created simple analytics adapter using universal-analytics for GA
create a file with that, put it in lib/analytics_adapter.js, then import it:
and pass to your ParseServer:
you'll also need to add
to your dependencies in package.json |
Thanks Marek 👍 I was planning to do quite the same thing using universal-analytics node module as well. You can even track appOpened returning trackEvent("AppOpened", parameters, req) . |
@fcoufour yes, but I'm not sure if it was fault of my application or something else, but AppOpened event seems to also trigger trackEvent, so it gets doubled |
@deashay Will check that soon. I'll let you know |
I believe you're right, the appOpened is not in use |
@deashay appOpened is used in the latest stable version (2.2.23) and there is no inner call to trackEvent |
* Allow usage of analytics adapter * Use promises in controller
* Allow usage of analytics adapter * Use promises in controller
I want to write my own adapter for google analytics, but parse-server in current state just ignores the analytics events, so I decided to write my own implementation of that, using patterns provided for other controllers/adapters/routers.
As you can see, this PR doesn't change the default behaviour of AnalyticsRouter, so default adapter does exactly the same things like before(that is: nothing), but I think being able to provide my own AnalyticsAdapter is crucial and much easier to implement than monkeypatching the whole server to catch requests.
Please let me know if that satisfies you or if you have any suggestions on how to improve it. To be honest I'd love to see it merged asap, because of deadlines in our project. If you decide to merge it, I'll provide GA adapter when its finished.