> ## Documentation Index
> Fetch the complete documentation index at: https://developer.voyado.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing and performance

Below you'll find diverse information to help you with testing, valiadtion, touble-shooting and measureing performance of your Onsite set-up.

## Testing and validation

Here is some useful information to help you with testing and validation.

### Using the Chrome Extension

1. Install the Voyado Chrome Extension
2. Navigate to your website
3. Wait for the page to fully load
4. Click the Voyado extension icon
5. Verify that the script is detected

The extension only detects if the script is loaded on the current page. It doesn't validate triggers or data.

### Browser Console Checks

Use this URL parameter to activate debug mode:

```http theme={null}
https://yoursite.com/?voyado-debug
```

Open your browser's developer console (F12) and check:

* The script loaded successfully: typeof redeal === 'function' — Should return: true
* The widget is open: typeof IsRedealOpen === 'function' && IsRedealOpen('cornerwidget') — Should return: true if cornerwidget is open
* There are script errors: Look for red errors in the console. Common issues:
  * Failed to load resource: [https://static.redeal.se/widget/js/redeal.js](https://static.redeal.se/widget/js/redeal.js) - Script blocked by firewall/CSP
  * redeal is not a function – Script not loaded or loaded after trigger call

### Clear testing session

Use this URL parameter to reset your test session:

```http theme={null}
https://yoursite.com/?voyado-clear
```

This clears local and session storage, allowing you to test onsite messages as an unidentified/new visitor.

### Testing checklist

* Script loads on all intended pages
* Only one script call loads per pageview
* Cornerwidget appears on landing pages
* Cornerwidget does NOT appear on checkout/cart pages
* Open widgets close when navigating to checkout (SPAs only)
* Checkout tag fires on order confirmation with correct data
* Login tag fires when user logs in
* Console shows no JavaScript errors
* All GTM variables return expected values
* Onsite message URL links work and trigger onsite messages
* Onsite messages only trigger on configured domains
* Test with ?voyado-clear to simulate new visitors

For implementations using Google Tag Manager, using GTM's Preview mode to ensure the tags are correctly installed and that triggers are firing appropriately with complete and correctly formatted variables is highly recommended.

### Network tab verification

In browser **DevTools > Network** tab:

1. Filter by “redeal”
2. Verify redeal.js loads successfully (Status: 200)
3. Check that POST requests to Voyado API return 200 status
4. Verify request payloads contain expected data

## Troubleshooting

Here are some tips to help with trouble-shooting of onsite messaging.

### Script not loading

**Symptoms:**

* Chrome extension shows no detection
* typeof redeal returns undefined
* No network requests to static.redeal.se

**Possible causes:**

1. Content Security Policy (CSP) blocking the script

**Solution**: Add [https://static.redeal.se](https://static.redeal.se) to your CSP script-src directive

2. Ad blocker or privacy extension

**Solution**: Disable extensions for testing or whitelist your domain

3. Firewall blocking external scripts

**Solution**: Whitelist [static.redeal.se](http://static.redeal.se) in your firewall rules

4. Incorrect GTM trigger configuration

**Solution**: Check trigger fires on page load using GTM Preview mode

5. Script tag syntax error

**Solution**: Validate HTML, ensure no extra characters in script tag

### Widget not appearing

**Symptoms:**

* Script loads but no widget visible
* Console shows no errors

**Possible causes:**

1. Domain not configured in Onsite Manager

**Solution**: Verify your domain is added to the onsite message configuration

2. Onsite message not active

**Solution**: Check onsite message status in Onsite Manager

3. Onsite message already shown to this user

**Solution**: Test with ?voyado-clear URL parameter

4. Wrong tag name

**Solution**: Verify tag name in code matches Onsite Manager configuration

5. Z-index conflict

**Solution**: Check if widget is rendering but hidden behind other elements

### Conversion not tracking

**Symptoms:**

* Checkout tag fires but conversions don't appear in reports

**Possible causes:**

1. Variables returning null or undefined

**Solution**: Use GTM Preview to verify variable values

2. Incorrect data types

**Solution**: Ensure total, revenue are strings, coupons is array

3. Currency code format

**Solution**: Use ISO 4217 codes (SEK, USD, EUR, etc.)

4. Race condition (script triggers before GTM variables populate)

**Solution**: Add a small delay or ensure dataLayer pushes before tag fires

### GTM variables not populating

**Symptoms:**

* GTM Preview shows undefined or null variable values

**Solutions:**

1. Verify dataLayer structure matches your variable configuration
2. Check that dataLayer.push() happens before page load events
3. Use “Data Layer Variable” type (not “JavaScript Variable”) in GTM
4. Test dataLayer in console: console.log(dataLayer)

### SPA issues

**Widget persists on checkout page:**

* Ensure Hide tag is implemented and triggering correctly
* Verify Hide tag trigger uses same event type as other triggers
* Check GTM Preview to confirm Hide tag fires

**Widget not appearing after navigation:**

* Confirm Cornerwidget tag triggers on virtual pageviews
* Verify history change events are captured in GTM
* Check that custom events fire consistently

**Script loaded multiple times:**

* Ensure if (typeof redeal !== 'function') wrapper is present
* Check GTM Preview for duplicate tag fires

### Console error messages

**Common errors and solutions:**

| Error                                                                             | Cause                         | Solution                                                  |
| --------------------------------------------------------------------------------- | ----------------------------- | --------------------------------------------------------- |
| Failed to load resource: [https://static.redeal.se/…](https://static.redeal.se/…) | Script blocked                | Check CSP, firewall, ad blockers                          |
| redeal is not a function                                                          | Script not loaded before call | Ensure script loader runs first                           |
| IsRedealOpen is not defined                                                       | Script not fully initialized  | Add conditional check: typeof IsRedealOpen === 'function' |
| Cannot read property 'email' of undefined                                         | Missing data object           | Verify GTM variables are defined                          |

## Performance & security

Performance and security can be improved by following these tips.

### Content Security Policy (CSP)

If your site uses CSP headers, add these directives:

```yaml theme={null}
Content-Security‐Policy:
  script-src 'self' https://static.redeal.se;
  connect-src 'self' https://*.redeal.se;
```

Without these directives, the script will be blocked by the browser.

### Script loading strategy

The Voyado script uses async loading to minimise performance impact:

```javascript theme={null}
a.async=1;  // Script loads asynchronously
```

**Benefits:**

* Non-blocking: Page rendering continues while script loads
* Fast: Script hosted on CDN with global distribution
* Cached: Browser caches script for subsequent visits

**Performance Impact:**

* Initial load: \~15-25 KB (minified and gzipped)
* Subsequent loads: 0 KB (cached)
* Page load delay: \<50 ms on average

### Best practices

**Do:**

* Load script on all relevant pages (cornerwidget is reusable)
* Use async loading (included in implementation)
* Implement proper CSP directives
* Test on staging before production
* Monitor console for errors after deployment

**Don't:**

* Block page rendering waiting for script
* Load script multiple times on same page (use conditional checks for SPAs)
* Hardcode customer data in JavaScript (security risk)
* Skip testing on different browsers
* Forget to update CSP when implementing

### Data privacy

**Email handling:**

* Emails are transmitted over HTTPS
* Never expose emails in URLs (use POST data)
* Comply with GDPR/privacy regulations in your region
* Inform users about data collection in your privacy policy

**Session data:**

* Script uses local storage and session storage
* Data is stored client-side only
* Use ?voyado-clear to manually clear stored data

### Browser compatibility

The script is compatible with:

* Chrome (latest)
* Firefox (latest)
* Safari (latest)
* Edge (latest)
* Mobile browsers (iOS Safari, Chrome Mobile)

Not supported:

* Internet Explorer 11 and earlier

## Additional resources

Onsite Manager: Configure onsite messages, sites/domains and view analytics

Chrome Extension: [Download here](https://chromewebstore.google.com/detail/voyado/lccnimeooniolaajpndmaichmjkcopdp)

GTM Documentation: [Google Tag Manager Help](https://support.google.com/tagmanager/answer/6103696)

Voyado Support: Contact your Voyado representative for technical assistance

If you have questions or encounter issues not covered in this guide, reach out to Voyado support or your Voyado representative.
