When using the JavaScript method growsurf.addParticipant(), why am I getting an error?
If you are using growsurf.addParticipant() and receiving a console error such as Error: Your session has expired. Please refresh your browser. , the browser session token has expired due to security reasons:
- Either the GrowSurf session token has expired due to a long browser session
- Or
growsurf.addParticipant()was called twice
Solution:
You will need to call growsurf.addParticipant() before the session expires.
Alternative solution:
If you are not able to call growsurf.addParticipant() before the session expires, one alternative proposal would be to use the Embedded Form and pass in your logged-in user's email address the data-grsf-email attribute. This way, your logged-in user will be added as a GrowSurf participant when they visit a certain webpage.
Here is example code:
<div data-grsf-block-form data-grsf-email="[email protected]">
Make sure to replace [email protected] with your logged-in user's email address.