Free plan · No credit card · Set up in 5 minutes

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 builderWhat to do
Gravity FormsAdd a Hidden field and set its Default Value to the field name, for example sx_channel.
Elementor FormsAdd a Hidden field and set its ID (Advanced tab) to the field name, or set its Default Value to sx_channel.
Contact Form 7Add [hidden sx_channel] to the form, and [sx_channel] to the mail template.
WPForms, Fluent Forms, FormidableAdd a Hidden field and set its Default Value to the field name.
HubSpot formsCreate contact properties named sx_channel and so on, and add them to the form as hidden fields.
Typeform, Tally, JotformAdd 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 nameWhat it holds
sx_summary RecommendedOne readable line with the full source story. Best for notification emails.
sx_channel RecommendedChannel of the latest visit, for example Paid Search.
sx_source RecommendedSource, for example google, facebook or chatgpt.
sx_mediumMedium, for example cpc, organic or referral.
sx_campaign RecommendedCampaign name or ID.
sx_term RecommendedPaid keyword (from utm_term or the {keyword} parameter).
sx_queryExact search query, when the ad platform passes it.
sx_contentAd or creative (utm_content).
sx_landing_pageLanding page of the latest visit.
sx_referrerReferring website.
sx_first_channel RecommendedChannel of the very first visit.
sx_first_sourceSource of the first visit.
sx_first_campaignCampaign of the first visit.
sx_first_landing_pageLanding page of the first visit.
sx_first_dateDate of the first visit.
sx_visitsNumber of visits before the enquiry.
sx_days_to_convertDays from the first visit to the enquiry.
sx_gclidGoogle click ID, for offline conversion imports.
sx_msclkidMicrosoft click ID.
sx_fbclidMeta 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:

CallReturns 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' }]);

Still need help?

Email info@sourcexray.com with your website address and what you tried.