-
Notifications
You must be signed in to change notification settings - Fork 17
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
JSON Parse error: Unable to parse JSON string - Issue while pushing event data #257
Comments
Hey @ygag-anase I tried doing clevertap.event.push, but didn't encounter any error. Can you please provide more details in what scenario this error is faced ?
|
Hi @KambleSonam, Thank you for the response. I don't think this issue is caused by the payload. I believe something going wrong inside the package after we are pushing the data. Also this issue rarely happens like 5%. I think inside of the package there is a scenario that is parsing the whole data which got from the user and it is getting failed there. Some times it throw error like |
Hey @ygag-anase . Thank You for the response. |
Hi @KambleSonam, Sure. // # Clevertap component `import { useEffect, useState } from "react"; function Clevertap({ clevertapAccountId }: { clevertapAccountId: string }) {
useEffect(() => {
}, [clevertapModule]); const initializeClevertap = async () => { return null; export default Clevertap; And we are calling the component inside _app.tsx and initialising the clevertap. (We are using nextjs 12 and 13 and both application has this issue) // #. Push event function
this is how we are managing our CleverTap cycle. Whe will be calling If you need any other information I'll be happy to provide, Thanks. |
Hey @ygag-anase Thank You for the response. |
Sometimes I'm facing trouble while pushing data to the CleverTap. Because of this reason only my 95 percentage of my events are getting tracked.
I'm using clevertap-web-sdk version 1.9.0.
This is how I pushing data to CT:
// #.dummy payload
const payload = {"Platform":"MWEB","Brand":"Birthday Card","Brand ID":"YUBCQAJJ07","Category Name":"Birthday","Purchase Type":"send-as-gift","Redemption Type":"online_store","Quantity":1,"Amount":200,"Currency":"QAR","Occasion":"BIR"}
function pushEvent(eventName: string, payload: {}) { try { typeof window !== 'undefined' && window?.clevertap?.event?.push(eventName, payload); } catch(err) { console.log("error in CT pushEvent",err); Sentry.captureMessage(
error in CT pushEvent - mWeb, ${JSON.stringify(err)}); } }
Usually I get following errors in my sentry logs in production:
{ message: JSON Parse error: Unable to parse JSON string, name: SyntaxError, stack: parse@[native code] it@https://d2r1yp2w7bby2u.cloudfront.net/js/clevertap.min.js:1:21249 processEvent@https://d2r1yp2w7bby2u.cloudfront.net/js/clevertap.min.js:1:98250 Fe@https://d2r1yp2w7bby2u.cloudfront.net/js/clevertap.min.js:1:14530 push@https://d2r1yp2w7bby2u.cloudfront.net/js/clevertap.min.js:1:13410 }
and
{ message: JSON Parse error: Unexpected identifier "c69678a5dc90478fbb4517d1f62c0015", name: SyntaxError, stack: parse@[native code] it@https://d2r1yp2w7bby2u.cloudfront.net/js/clevertap.min.js:1:21249 processEvent@https://d2r1yp2w7bby2u.cloudfront.net/js/clevertap.min.js:1:98250 Fe@https://d2r1yp2w7bby2u.cloudfront.net/js/clevertap.min.js:1:14530 push@https://d2r1yp2w7bby2u.cloudfront.net/js/clevertap.min.js:1:13410 }
The text was updated successfully, but these errors were encountered: