rorygarand / react-amplitude

React Amplitude Analytics
11 stars 13 forks source link

React-ify #9

Open boxman0617 opened 6 years ago

boxman0617 commented 6 years ago

As of now this library acts as a wrapper for Amplitude with some error handling, would love for this to have more of a declarative approach that would allow users to declare events through an element and props:

<AmplitudeEvent on="mount" eventType="test" eventProps={{ prop: 'test' }} />
rorygarand commented 6 years ago

I typically build my analytics into middleware. When a redux action is fired the middleware does a quick check on the type, and potentially fires off some Amplitude event.

What you're suggesting could be easily done and might be a better solution for projects without redux.

I've been marinating on this suggestion for a while and I think I haven't grasped the full extent of what this would look like. Can you give more examples? Or, talk me through what you're thinking?

ryanashcraft commented 6 years ago

@boxman0617 Ryan from Amplitude here. I'm really excited that people in the React community are innovating in this space! We just open-sourced our take on a react-amplitude library with a React-ey API and would love feedback: https://github.com/amplitude/react-amplitude

@rorygarand Would love to hear your thoughts as well. Perhaps we could combine efforts?