SourceXray captures enquiries from the forms on your site, whatever builder they use. Every lead lands in your dashboard with its source, with no form changes. Hidden fields are only needed if you also want the source inside the form builder's own emails, entries or CRM.
Forms that need nothing
- Plain HTML forms that post to your server (PHP mailers, Formspree, Basin, Getform and similar): the source fields are added automatically. To choose exactly which fields, add
<input type="hidden" name="sx_channel">yourself and SourceXray fills only the ones you added. - Webflow: the source fields are added to Webflow forms and show in submissions and notification emails.
- Shopify contact form: Lead source, Channel, Campaign and Keyword are added to the contact email.
- WordPress: the WordPress plugin adds the source to notification emails for the popular form plugins.
Adding a hidden field in your form builder
Form builders that only save the fields they know about need the hidden field added once. Add a hidden field and set its default value (or its name) to one of the field names below, such as sx_channel. SourceXray fills it in on the page, including forms in popups.
| Form builder | What to do |
|---|---|
| Gravity Forms | Add a Hidden field and set its Default Value to the field name, for example sx_channel. |
| Elementor Forms | Add a Hidden field and set its ID (Advanced tab) to the field name, or set its Default Value to sx_channel. |
| Contact Form 7 | Add [hidden sx_channel] to the form, and [sx_channel] to the mail template. |
| WPForms, Fluent Forms, Formidable | Add a Hidden field and set its Default Value to the field name. |
| HubSpot forms | Create contact properties named sx_channel and so on, and add them to the form as hidden fields. |
| Typeform, Tally, Jotform | Add hidden fields with the same names. SourceXray passes them through the embed address automatically. |
Field names
Recommended fields are marked. sx_summary is the easiest place to start: one readable line such as Paid Search: google / cpc, campaign Family Law, keyword "family lawyer sydney". First visit: Organic Search, 3 visits over 6 days.
| Field name | What it holds |
|---|---|
sx_summary Recommended | One readable line with the full source story. Best for notification emails. |
sx_channel Recommended | Channel of the latest visit, for example Paid Search. |
sx_source Recommended | Source, for example google, facebook or chatgpt. |
sx_medium | Medium, for example cpc, organic or referral. |
sx_campaign Recommended | Campaign name or ID. |
sx_term Recommended | Paid keyword (from utm_term or the {keyword} parameter). |
sx_query | Exact search query, when the ad platform passes it. |
sx_content | Ad or creative (utm_content). |
sx_landing_page | Landing page of the latest visit. |
sx_referrer | Referring website. |
sx_first_channel Recommended | Channel of the very first visit. |
sx_first_source | Source of the first visit. |
sx_first_campaign | Campaign of the first visit. |
sx_first_landing_page | Landing page of the first visit. |
sx_first_date | Date of the first visit. |
sx_visits | Number of visits before the enquiry. |
sx_days_to_convert | Days from the first visit to the enquiry. |
sx_gclid | Google click ID, for offline conversion imports. |
sx_msclkid | Microsoft click ID. |
sx_fbclid | Meta click ID. |
Using the lead in Google Tag Manager
After a form is sent successfully, SourceXray pushes an sx_lead event to the dataLayer with the channel, source, medium, campaign, keyword, first channel, landing page and form name. It never contains personal details. Use a Custom Event trigger called sx_lead to fire GA4 or ads conversion tags only on real leads, or let AI Tracking Setup build it for you.
JavaScript API
For custom forms and booking tools, window.SourceXray gives you the visitor's source:
| Call | Returns or does |
|---|---|
SourceXray.fields() | An object with every sx_ field and its value. |
SourceXray.get() | The first and latest touch, visits and first seen date. |
SourceXray.fill() | Fills the hidden fields on the page again (useful after you render a form). |
SourceXray.lead({{ name, email, phone }}) | Records a lead yourself, for example after a booking is confirmed. |
If your code may run before the script loads, queue the call: window.sxq = window.sxq || []; sxq.push(['lead', { email: 'sarah@example.com' }]);
Email info@sourcexray.com with your website address and what you tried.