-
Notifications
You must be signed in to change notification settings - Fork 19
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 nextJS app example #53
Conversation
// clevertap.default.init(ACCOUNT_ID, TARGET_DOMAIN) | ||
// clevertap.privacy.push({ optOut: false }) | ||
// clevertap.privacy.push({ useIP: false }) | ||
clevertap.default.setLogLevel(3) |
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.
No need to set setLogLevel(3)
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.
i guess this example might imply that it is needed. I put it there to make the user see it in the devtool when they try it. Anyway, i guess I can comment that out too.
This is to make example app more focused on its purpose: setup
Did this work for anyone? |
yes |
Did you call the function inside a useEffect? useEffect(() => { |
@maurusrv Kindly go through the sample Nextjs web app. Let us know if you are facing any issues here. |
@KambleSonam any differences that i miss between the demo repo and this PR? if none, it should be good as i also see the dev logs too on the demo site.
thanks! |
Yes @maurusrv , you can close the PR. Do let us know if you face any issues with clevertap-web-sdk |
This project illustrates how to import the
clevertap-web-sdk
on a nextJS app.Since the module is designed for client-side only, for nextJS apps, one can't straightforwardly import the sdk like:
due to the library expecting for window object to be defined. See #52
Aside from a workaround, one can asyncly import it when the component mounts or just before an event push:
This example app does not include the use of react context for simpler implemention or different state / context management.