You can use Outseta's registration defaults to capture UTM parameters at sign-up for accurate marketing attribution. The following custom code snippet adds these UTM values as hidden fields in your registration form.
The snippet in this article implements first-touch attribution, which ensures proper credit is given to the original marketing source even if users return later through different channels.
A typical URL with UTM parameters looks like: https://www.example.com/landing-page?utm_source=facebook&utm_medium=social&utm_campaign=summer_sale
👉 You might also be interested in Attribute sign-ups with the referring domain
Prerequisite
- You need the following account custom properties:
- Label: "Utm Source", System name:
UtmSource
, Control type: Text - Label: "Utm Campaign", System name:
UtmCampaign
, Control type: Text - Label: "Utm Medium", System name:
UtmMedium
, Control type: Text
- Label: "Utm Source", System name:
Custom Snippet
Paste the following custom snippet ABOVE the Outseta Options and Script already in the head of your site:
<!--- ✨ Start: Custom UTM Snippet ----> <script> var UtmValues = {}; try { var localStorageKey = "o-snippet.utm"; UtmValues = JSON.parse(localStorage.getItem(localStorageKey)); if (!UtmValues) { // No existing utm values, check for current ones var params = new URL(window.location).searchParams; var UtmSource = params.get("utm_source"); var UtmCampaign = params.get("utm_campaign"); var UtmMedium = params.get("utm_medium"); if (UtmSource || UtmCampaign || UtmMedium) { // Sets first touch UTM values if at least one is present UtmValues = { UtmSource, UtmCampaign, UtmMedium }; localStorage.setItem(localStorageKey, JSON.stringify(UtmValues)); } } } catch (error) { console.warn("Problem with utm capture", error.message); } </script> <!--- Custom UTM Snippet: End ✨ ---->
💡 Remember to add a comma to the end of the last line in your current options if there is none. Otherwise, you'll see a popup stating "[domain] is a required option to initialize the Outseta script."
⚠️ If you are using the referring domain in combination with referring domain attribution, update your options to this instead:
<!-- Outseta Options -->
<script>
var o_options = {
domain: "snippets.outseta.com",
auth: {
registrationDefaults: {
Account: {
...UtmValues,
ReferringDomain,
}
},
}
};
</script>
<!-- Outseta External Script -->
<script src="https://cdn.outseta.com/outseta.min.js" data-options="o_options"></script>