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:
    1. Label: "Utm Source", System name:UtmSource, Control type: Text 
    2. Label: "Utm Campaign", System name:UtmCampaign, Control type: Text 
    3. Label: "Utm Medium", System name:UtmMedium, Control type: Text 

Custom Snippet

Paste the following custom snippet ABOVE the Outseta Options and Script already in the head of your site:

<!---✨ Custom UTM Snippet ---->
<script>
var UtmValues = JSON.parse(localStorage.getItem("o-snippet.utm"));
if (!UtmValues) {
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 one is present
UtmValues = { UtmSource, UtmCampaign, UtmMedium };
localStorage.setItem("o-snippet.utm", JSON.stringify(UtmValues));
}
}
</script>
<!--- Custom UTM Snippet ✨ ---->

Then update your existing Outseta Options with the auth options seen below:

<!-- Outseta Options -->
<script>
var o_options = {
domain: "snippets.outseta.com",
auth: {
registrationDefaults: {
Account: {
...UtmValues,
}

},
}
};
</script>

<!-- Outseta External Script -->
<script src="https://cdn.outseta.com/outseta.min.js" data-options="o_options"></script>

💡 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>