-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add ArcxAnalyticxProvider and an example CRA app #21
Conversation
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.
This is because the npm package is not yet published. The way to make it work on this branch is to:
Then try again. The idea however is to publish this package and make the example repo pull the package from npm directly. |
3c2355e
to
922fd39
Compare
add window object typing rm comments and log do not save the url on the window object and add medium option to attribute call make the current url private add arcx analyticx provider and CRA example project log page events track event clicks on console view update readme fix installations add missing peer dependencies ignore webpack config ts to avoid eslint errors update header and favicon support react versions >=16
3fe072e
to
2722a6a
Compare
package.json
Outdated
"@babel/core": "^7.0.0-0", | ||
"@babel/plugin-syntax-flow": "^7.14.5", | ||
"@babel/plugin-transform-react-jsx": "^7.14.9", |
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.
why do we need babel?
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.
peer dependencies requirement
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.
From which package? :)
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.
eslint-config-react-app
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.
.. but now I realized we don't use it in this scope, so removed it! :) good catch!
@@ -0,0 +1 @@ | |||
/// <reference types="react-scripts" /> |
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.
?
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.
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.
Nothing critical, but address the comments at your discretion
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.
Discussed via dm's
The SDK as-is was a bit of a pain to use as users need to make a custom react provider in their react apps. For this reason, I made a utility
ArcxAnalyticsProvider
that does that for you. It requires theapiKey
and can optionally take aconfig
object.The provider initializes the SDK and exposes a hook
useArcxAnalytics()
that children of the provider can use.The tests for the provider will be in a subsequent PR because of some configuration changes regarding the test framework and I don't want to make this PR too big.
In addition, I've added an example Create React App showcasing how to use the provider, with a console-like view showing what events have been fired. I tested this app using
yarn link
, but once the npm package is updated we'll be able to test it using the official npm package.