Identify users on Wix
Updated December 1, 2026
Learn how to automatically identify website visitors when they submit forms on your Wix site, enabling cross-device tracking and enriched visitor profiles in Lytical.
What this enables: When a visitor fills out a form (contact form, newsletter signup), Lytical will link their anonymous browsing history to their real identity. You'll see their name and email in the Identified Users report, and can track them across multiple devices and sessions.
Prerequisites
- Lytical tracking code installed on your Wix site
- Wix Premium plan (required for custom code)
- One or more Wix Forms on your site
Where to Add the Code
Wix offers two ways to add custom tracking code:
Custom Code in your dashboard
- Go to your Wix Dashboard
- Click Settings → Custom Code
- Click + Add Custom Code
- Paste the script
- Set placement to Body - end
- Apply to All pages
- Click Apply
Wix Forms Integration
Wix Forms use a custom event system. This script listens for form submissions and captures the email field.
<script>
// Lytical + Wix Form Integration
(function() {
// Store form data before submit
var pendingForms = new WeakMap();
// Helper: Extract fields from form
function extractFields(form) {
var data = {};
var inputs = form.querySelectorAll('input, textarea, select');
inputs.forEach(function(input) {
var name = input.name || input.getAttribute('data-field-label') ||
input.placeholder || input.id || '';
var value = input.value;
if (name && value) {
data[name.toLowerCase()] = value;
}
});
var result = {};
// Find email
for (var key in data) {
if (key.includes('email') || key.includes('e-mail')) {
result.email = data[key];
break;
}
}
// Find name
for (var key in data) {
if (key === 'name' || key.includes('full name') || key.includes('your name')) {
result.name = data[key];
break;
}
}
if (!result.name) {
var firstName = '', lastName = '';
for (var key in data) {
if (key.includes('first')) firstName = data[key];
if (key.includes('last')) lastName = data[key];
}
if (firstName || lastName) {
result.name = [firstName, lastName].filter(Boolean).join(' ');
}
}
// Find phone
for (var key in data) {
if (key.includes('phone') || key.includes('tel') || key.includes('mobile')) {
result.phone = data[key];
break;
}
}
return result;
}
// Detect source from page URL
function detectSource() {
var path = location.pathname.toLowerCase();
if (path.includes('contact')) return 'contact_form';
if (path.includes('newsletter')) return 'newsletter_signup';
if (path.includes('booking')) return 'booking_request';
return 'wix_form';
}
// Capture form data on submit
document.addEventListener('submit', function(e) {
var form = e.target;
if (form && form.tagName === 'FORM') {
pendingForms.set(form, extractFields(form));
}
}, true);
// Watch for Wix form success states
// Wix shows a success message after submission
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
mutation.addedNodes.forEach(function(node) {
if (node.nodeType === 1) {
// Check for Wix form success message
if ((node.getAttribute && node.getAttribute('data-testid') === 'thankYouMessage') ||
(node.className && node.className.includes && node.className.includes('thank-you')) ||
(node.className && node.className.includes && node.className.includes('success'))) {
// Find the associated form
var formContainer = node.closest('[data-testid="form-container"]') ||
node.closest('.wix-form') ||
node.parentElement;
if (formContainer) {
var form = formContainer.querySelector('form');
if (form) {
var fields = pendingForms.get(form);
if (fields && fields.email && typeof lyt !== 'undefined') {
lyt.identify(fields.email, {
email: fields.email,
name: fields.name || '',
phone: fields.phone || '',
source: detectSource()
});
console.log('[Lytical] Identified user:', fields.email);
}
}
}
}
}
});
});
});
observer.observe(document.body, {
childList: true,
subtree: true
});
// Alternative: Capture on submit (before success confirmation)
// Use this if the MutationObserver method doesn't work
document.addEventListener('click', function(e) {
var button = e.target.closest('button[type="submit"], input[type="submit"], [data-testid="submit-button"]');
if (!button) return;
var form = button.closest('form');
if (!form) return;
// Small delay to let form validate
setTimeout(function() {
var fields = extractFields(form);
if (fields.email && typeof lyt !== 'undefined') {
lyt.identify(fields.email, {
email: fields.email,
name: fields.name || '',
phone: fields.phone || '',
source: detectSource()
});
console.log('[Lytical] Identified user:', fields.email);
}
}, 100);
}, true);
})();
</script>
Wix Members and Velo
Wix doesn't expose a logged-in member's email to custom code, and Velo (Dev Mode) code runs in a sandbox that can't reach the Lytical script on the page. So neither can call lyt.identify for logged-in members. Members are identified the first time they submit a form on your site (see Wix Forms Integration above), and Lytical links their earlier visits on that device to them.
Wix Stores (E-commerce)
For Wix Stores, identifying customers at checkout is limited because Wix handles checkout on their own pages. However, you can identify customers when they:
- Log in to their member account (use the Members script above)
- Submit a contact form or newsletter signup
- Create an account during checkout (they'll be logged in afterward)
Troubleshooting
Users aren't appearing in Identified Users
- Make sure you have a Wix Premium plan (required for custom code)
- Verify the script placement is set to "Body - end"
- Check that Lytical tracking code loads before the identify script
- Open browser DevTools → Console and look for
[Lytical] Identified user:messages
Form field names vary
Wix Forms don't use consistent field names. The script tries to detect email/name fields by their labels and placeholders. If it's not working, open DevTools and inspect your form to see the actual field names, then update the script accordingly.
Testing the integration
- Open your website in an incognito/private browser window
- Open DevTools → Console before submitting the form
- Browse a few pages to generate anonymous activity
- Submit a form with a test email address
- Look for
[Lytical] Identified user: test@example.comin the console - Wait 1-2 minutes, then check the Identified Users page in Lytical
Need help? If you're having trouble with the integration, reach out to our support team and we'll help you get it set up. Email support@lytical.ai.
Was this article helpful?
Thanks for letting us know.
Related articles
Still stuck?
Ask Quincy in the app, or email support@lytical.ai.