Skip to main content

UserWay Widget Advanced Script Attributes Guide

This article explains each optional attribute available in the UserWay widget installation Advanced script and how each one can be used to customize the widget.

Quick Menu


Default Installation Script

<script>
(function(d){
var s = d.createElement("script");

/* uncomment the following line to override default position*/
/* s.setAttribute("data-position", 1);*/

/* uncomment the following line to override default size (values: small, large)*/
/* s.setAttribute("data-size", "large");*/

/* uncomment the following line to override default language (e.g., fr, de, es, he, nl, etc.)*/
/* s.setAttribute("data-language", "null");*/

/* uncomment the following line to override color set via widget (e.g., #053f67)*/
/* s.setAttribute("data-color", "#0048FF");*/

/* uncomment the following line to override type set via widget (1=person, 2=chair, 3=eye, 4=text)*/
/* s.setAttribute("data-type", "1");*/

/* s.setAttribute("data-statement_text", "Our Accessibility Statement");*/
/* s.setAttribute("data-statement_url", "http://www.example.com/accessibility");*/

/* uncomment the following line to override support on mobile devices*/
/* s.setAttribute("data-mobile", true);*/

/* uncomment the following line to set custom trigger action for accessibility menu*/
/* s.setAttribute("data-trigger", "triggerId");*/

s.setAttribute("data-account", "PTR1249toR");
s.setAttribute("src", "https://cdn.userway.org/widget.js");

(d.body || d.head).appendChild(s);
})(document)
</script>

data-position

Controls where the accessibility icon appears on the screen.

s.setAttribute("data-position", 1);

Value

Position

1

Top Right

2

Middle Right

3

Bottom Right

4

Bottom Middle

5

Bottom Left

6

Middle Left

7

Top Left

8

Top Middle

 -----------------------------------------------------------
| 7 - Top Left 8 - Top Middle 1 - Top Right |
| |
| 6 - Middle Left 2 - Middle Right |
| |
| 5 - Bottom Left 4 - Bottom Middle 3 - Bottom Right |
-----------------------------------------------------------

data-size

Changes the size of the accessibility icon.

s.setAttribute("data-size", "large");

Value

Description

"small"

Standard compact icon

"large"

Larger icon


data-language

Forces the widget interface language.

s.setAttribute("data-language", "fr");

Code

Language

en

English

fr

French

de

German

es

Spanish

he

Hebrew

nl

Dutch

pt

Portuguese


data-color

Changes the widget button color.

s.setAttribute("data-color", "#0048FF");

Color

HEX

Blue

#0048FF

Green

#00A86B

Black

#000000

Red

#FF0000


data-type

Changes the accessibility icon style.

s.setAttribute("data-type", "1");

Value

Icon Type

1

Person

2

Wheelchair

3

Eye

4

Text


data-statement_text

Defines the custom text shown for the accessibility statement link.

s.setAttribute("data-statement_text", "Our Accessibility Statement");

data-statement_url

Defines the URL for the accessibility statement page.

s.setAttribute("data-statement_url", "https://example.com/accessibility");

data-mobile

Enables or disables widget support on mobile devices.

s.setAttribute("data-mobile", true);

Value

Description

true

Enable widget on mobile

false

Disable widget on mobile


data-trigger

Uses a custom HTML element to open the accessibility menu instead of the default floating icon.

s.setAttribute("data-trigger", "triggerId");

Example HTML trigger:

<button id="triggerId">Accessibility</button>

data-account

Defines the UserWay account ID connected to the widget.

s.setAttribute("data-account", "PTR1249toR");

Customized Script Example

<script>
(function(d){
var s = d.createElement("script");
s.setAttribute("data-position", 3);
s.setAttribute("data-size", "large");
s.setAttribute("data-language", "es");
s.setAttribute("data-color", "#0048FF");
s.setAttribute("data-type", "1");
s.setAttribute("data-statement_text", "Accessibility Statement");
s.setAttribute("data-statement_url","https://example.com/accessibility");
s.setAttribute("data-mobile", true);
s.setAttribute("data-account", "PTR1249toR");
s.setAttribute("src", "https://cdn.userway.org/widget.js");
(d.body || d.head).appendChild(s);
})(document)
</script>

Need more help? Contact the UserWay Support Team — we're here to assist you.
​Get in touch with UserWay Support.

Did this answer your question?