Skip to main content

How to Integrate the RxScale Questionnaire on Your Website

A step-by-step guide to installing and configuring the RxScale questionnaire.

Cassian Brosius avatar
Written by Cassian Brosius
Updated over 3 weeks ago

RxScale allows you to embed medical questionnaires directly into your website. These questionnaires can be used to collect medical information, guide patients through recommendation flows, or support compliance workflows.
This article explains how to install the questionnaire, configure integrations, and use available JavaScript hooks.

1. Overview

All questionnaires are created and configured inside the RxScale Admin Tool.
From there, you receive:

  • Your Questionnaire UID

  • The installation snippet

  • Optional custom styling and integrations

RxScale automatically renders the questionnaire depending on the configured type (e.g., Product Recommender, Direct to Cart).


2. Installation

To display a questionnaire on your page, paste the installation snippet into your website. A typical snippet looks like this:

<div id="rxscale_questionaire"></div> // Placeholder for the questionaire
<script>
window.rxscale_questionaire_uid = "XXXXXXX";
</script>
// Assign your specific questionnaire UID
<script
defer
src="https://snippets.rxscale.com/v2.7/index.js">
</script>
// Main JS for rendering
<link
href="https://snippets.rxscale.com/v2.7/index.css"
rel="stylesheet"

> // Default styling

<link
href="https://customizations.rxscale.com/XXXXXXXX/css/
customization.css"
rel="stylesheet"
>
// Optional custom styling

What this snippet does

  • Renders your questionnaire automatically

  • Loads necessary JavaScript and CSS

  • Supports versioned releases — safe testing without affecting production



3. Questionnaire Types

RxScale automatically renders the specified questionnaire and responds to the questionnaire type defined in the Admin Tool.

1. Product Recommender:

Shows a step-by-step flow to recommend products based on user answers.

2. Direct to Cart:

Redirects users directly to the cart after completion (unless configured otherwise).




4. Optional Integrations & Hooks

RxScale supports optional JavaScript hooks that trigger on specific events within the webpage. These hooks are independent and modular. The following integrations are supported:

  1. Klaviyo

  2. Helium Account Management

  3. DataLayer for Google Tag Manager

  4. Window Event Handlers

The following sections will guide through each of these options:


01. Klaviyo Integration

Prerequisite: The Klaviyo snippet must already be installed on your website.

User responses can be used to:

  • identify Klaviyo profiles

  • trigger events in your Klaviyo flows

The integration uses the existing Klaviyo SDK.


02. Helium Account Management

Prerequisite: The Helium snippet must be present on your site.

Allows:

  • Account creation or identification using questionnaire responses

  • Pre-filling login or user data based on previous submissions


03. Google Tag Manager / DataLayer

RxScale pushes structured events into the dataLayer object to support integrations with Google Tag Manager and similar tools. Events are triggered both on page transitions and upon questionnaire completion.

  • Current step

  • Previous step

  • Step name

  • Questionnaire version

  • Questionnaire name

  • Questionnaire ID

Events fire both on step changes and on questionnaire completion.


04. Window Event Handler

RxScale can invoke a custom JavaScript callback named rxscaleQuestionnaireCompleted after a successful questionnaire submission.

Example usage:

window.rxscaleQuestionnaireCompleted = ({ submissionId }) => {

// Custom logic, e.g., redirect or analytics

};

This hook enables developers to implement custom post-submission workflows tailored to their shop’s needs.


5. Attach a Submission to a Shopify Order

To enable RxScale to associate a specific submission with a Shopify order, it's essential to include identifying metadata within the order. The required information can be stored either at the order level or within each order item, depending on your implementation needs.


If you choose to send data from your own questionnaire, you need to also provide the external provider identifier together with the anamnesis uid. This way, we can uniquely identify your submission.

Required Property only for RxScale Questionnaires

_anamnesis_uid

Required only for external providers

_external_submission_identifier

Required only for external providers

_external_provider_uid

  • Priority: If both are present, the order item-level property takes precedence.

  • Important Note: Storing _anamnesis_uid at the order level allows Shopify to duplicate orders if necessary (e.g. via reorder functionality). Use this approach if your business logic supports or relies on order duplication.

To set this property on a Shopify store, you can use the example below. This snippet attaches the _anamnesis_uid to the cart, which is later passed into the order during checkout:

fetch('/cart/update.js', {

method: 'POST',

headers: {
'Content-Type': 'application/json'

},

body: JSON.stringify({

attributes: {

_anamnesis_uid: "",

_external_submission_identifier: "" // only required for external question naire submissions

_external_provider_uid: "" // only required for external questionnaire submissions

}

})

})


6. Pharmacy Selection

To associate the selected pharmacy with an anamnesis submission, send the relevant information to the RxScale API using the following snippet:

attribute s/pharmacy`, {

method: 'PUT',

headers: {

'Content-Type': 'application/json'

},

body: JSON.stringify({

key: "pharmacy_email",

value: pharmacyEmail,

pharmacy_uid: pharmacyUid

})

});

If the selected pharmacy does not have an email address and receives its data through an API integration, simply pass an empty string for the value field.


7. Patient Status

To check when a patient last successfully signed an anamnesis, query our backend after Shopify login using the Shopify customer ID and store identifier.

fetch("https://api.rxscale.com/api/v0/patient/intent?shop_customer_id=XXXX &shop_identifier=XXXXX&intent=XXXX", requestOptions)

.then((response) => response.text())

.then((result) => console.log(result))

.catch((error) => console.error(error);

Note that questionnaires for the submission must be tagged with the intent.

The response will contain a return code in the body with the following meanings:

Return Code

Meaning

100

No previous submission or last signed submission older than 24 months

200

Last signed submission between 12 and 24 months

300

Last signed submission in the last 12 months

An example response can be found here:

{

"return_code": 300

}

Did this answer your question?