@patientprism/snippet-sdk
v1.1.13
Published
This package includes the Patient Prism Snippet SDK typings, used to assist you with integrating the Patient Prism Snippet into your custom application flow.
Downloads
1,106
Readme
Patient Prism Snippet SDK
This package includes the Patient Prism Snippet SDK typings, used to assist you with integrating the Patient Prism Snippet into your custom application flow.
How to use
import type { PrismSDK, Submission } from '@patientprism/snippet-sdk';
// Submitting a form
const data: Submission = {
name: {
type: 'text',
value: 'John Doe',
label: 'Name'
}
};
(window.$prism as PrismSDK).submission.send(data, 'elementId');Form Tracking Control
You can control which forms and fields are tracked by the snippet using data attributes:
data-prism-exclude-form: Add this attribute to any form element to exclude the entire form from trackingdata-prism-exclude-input: Add this attribute to any input element to exclude just that specific field from trackingdata-prism-field-label: Add this attribute to any input element to override the label used for tracking
Example:
<!-- This form will be tracked, but the password field will be excluded -->
<form id="signup-form">
<input type="text" name="email" placeholder="Email">
<input type="password" name="password" data-prism-exclude-input placeholder="Password">
<button type="submit">Sign Up</button>
</form>
<!-- This entire form will be excluded from tracking -->
<form id="login-form" data-prism-exclude-form>
<input type="text" name="username" placeholder="Username">
<input type="password" name="password" placeholder="Password">
<button type="submit">Login</button>
</form>
<!-- Override field labels for tracking -->
<form id="contact-form">
<input type="text" name="name" data-prism-field-label="Patient Name" placeholder="Your Name">
<input type="email" name="email" data-prism-field-label="Patient Email" placeholder="Your Email">
<button type="submit">Submit</button>
</form>