SoluCX Widget
The SoluCX widget allows the integration of surveys directly into your website, providing an easy and efficient way to collect customer feedback.
Compatibility with Form Flex and Survey Research
The widget is compatible with Form Flex and Survey research types, allowing flexibility in data collection according to your business needs.
Installation
To use the widget, add the following script to your website:
This script exposes the global function createSoluCXWidget, which is used to initialize the widget.
Usage via Script Tag
For direct insertion via <script> in HTML:
- Add the script above in the
<head>tag or before the closing<body>tag in your HTML. - Create the widget inside a
<script>tag.
Note: When added in the
<head>tag, it is necessary to check if the DOM has loaded or add the function in some trigger method (e.g., button click).
Example:
Usage via Google Tag Manager
To use the SoluCX Widget within Google Tag Manager (GTM):
- Access your GTM account and select the desired container.
- Click on Tags in the side menu and then on New.
- Give the tag a name and click on Tag Configuration.
- Select Custom HTML.
- In the Custom HTML field, insert the following code (adjusting as needed):
- In Triggering, select when you want the tag to be triggered (e.g., on all pages).
- Save the tag and publish the changes in the container.
Note: The
<script src="https://widget.solucx.com.br/widget.js"></script>tag can be placed together with the custom code above in the same Custom HTML Tag, or in a separate tag that fires before it (e.g., on site initialization). The important thing is that the script is loaded before calling thecreateSoluCXWidgetfunction.
Advanced Example: Floating "Rate Us" Button
In this example, the widget script is loaded in a separate tag on site initialization. A second tag creates a floating button on the side of the page that, when clicked, opens the widget. The button is only displayed after verifying that the createSoluCXWidget function is available.
Tag 1 — Script Loading (triggered on all pages):
Tag 2 — Floating Button + Widget (triggered on all pages, after Tag 1):
Widget Types
The available widget types are:
bottomBar: Displays the widget as a fixed bar at the bottom of the page.
In bottomBar mode, the widget is displayed as a fixed horizontal bar at the bottom of the page.
This means it remains visible as the user scrolls the page, ensuring the widget is always accessible.bottomBox: Displays the widget as a fixed box in the bottom right corner of the page.
In bottomBox mode, the widget is displayed as a fixed box in the bottom right corner of the page.
This allows the widget to stand out without interfering with the main content, ideal for capturing user attention.bottomBoxLeft: Displays the widget as a fixed box in the bottom left corner of the page.
In bottomBoxLeft mode, the widget is displayed as a fixed box in the bottom left corner of the page.
Like bottomBox, it highlights the widget without interfering with the main content, but positioned on the left side.inline: Displays the widget embedded in the page content.
In inline mode, the widget is displayed directly within the existing layout.
This means it integrates seamlessly with the page content, without overlapping or covering other elements. Ideal when you want the widget to be part of the natural content flow.modal: Displays the widget as a centered modal on the page.
In modal mode, the widget is displayed as a centered modal window on the page.
This means it overlays the page content, capturing all of the user's attention. Ideal when you want to ensure the user interacts with the widget before continuing to browse.
Initialization Parameters
The createSoluCXWidget function accepts the following parameters:
Parameter apiKey (string) Required
API key provided by SoluCX.
Example:
Parameter type (string) Required
Type of widget to be created. Accepted values:
inlinebottomBarbottomBox(positioned to the right by default)bottomBoxLeftmodal
Example:
Parameter data
transaction_id OR name AND (email OR phone) transaction_id OR customer_id transaction_id OR customer_id AND phone transaction_id OR customer_id AND email transaction_id transaction_id transaction_id Example:
Any field prefixed with param_ is considered an extra transaction parameter that can be used for traceability.
Parameter options
Important about Quarantine: The widget's quarantine control is based on the customer's browser cookies. This means that the quarantine is not 100% guaranteed, as the user can clear cookies, use different browsers, different devices, or incognito/private browsing mode. For scenarios that require strict quarantine control, we recommend implementing additional validations on the server side.
Example:
Callbacks Configuration
The widget supports callback functions that are triggered when specific events occur. Add them to your options object:
callbacks(object): Optional callback functions for widget events.onOpened(function): Called when the widget is opened. ReceivesuserIdas parameter.onClosed(function): Called when the widget is closed.onError(function): Called when an error occurs. Receives errormessageas parameter.onPageChanged(function): Called when the user navigates to a different page within the widget. Receivespageas parameter.onQuestionAnswered(function): Called when the user answers a question.onCompleted(function): Called when the widget is completed successfully. ReceivesuserIdas parameter.onPartialCompleted(function): Called when the widget is partially completed. ReceivesuserIdas parameter.onResize(function): Called when the widget is resized. Receivesheightas parameter.
Example with callbacks:
Complete Example:
Widget Response Handling
The createSoluCXWidget function returns a promise that resolves to an object with the following structure:
- status:
"success"or"error" - message: A string containing an error message if the status is
"error"
Example:
Conclusion
By following the instructions above, you can quickly integrate and configure the SoluCX Widget in your application or website. Use the provided examples to adjust and customize the widget according to your data collection and customer feedback needs.
If you have any questions or encounter any issues, please contact SoluCX support. Happy implementation!