Sup Save Url Parameters Save

Sup.js saves URL parameters and inputs them into any form submitted during a visitors session on you site.

Project README

Sup.js: Save URL Parameters

SUP (Save URL Parameters) is a script that lets you save URL parameters and values in a visitor's session, then insert them into any form the visitor submits during their session.

See demo→

See longer article with background and examples: Get URL + UTM Parameters with Javascript.

Why

Adding parameters (or queries) to a URL can provide additional information about website visitors, such as:

  • The marketing source of the visitor, using standard UTM tags (utm_medium, utm_campaign, utm_source, utm_content, and utm_term) or custom parameters.
  • The search query they used on your site.
  • The referral, affiliate, or promo linked they used to reach your site.

It is often helpful to capture that information any time a visitor submits a form on your website. For example, if a visitor completes a signup or contact form, you might want to know what marketing campaign can be attributed with that conversion. Some marketing platforms and form tools are able to capture URL parameters, but only if they are present on the page—if a visitor views more than one page then the URL parameters will not be saved. Unfortunately this means it works only if the visitor completes the form on the same page they landed on, without navigating away.

Some analytics tools can recognize and report on some or all URL parameters, but they don't show it side-by-side with form data. For example, Google Analytics only parses UTM parameters, and it does not allow you to save personal information from forms. In many cases you may want to see those values for every form completion.

There exist many similar scripts that capture UTM tags (utm_medium, etc) but not any custom parameters. They are not helpful if you want to track a custom parameter such as referral, promo, ref, search, and so on.

This script captures and saves any parameter in the URL, then inserts the value of that parameter into any form on your site that has a name that matches the parameter key. You can make the form field hidden since it is filled in automatically and does not need any input from the visitor.

How

  1. Add the following code to every page on your site where you want to capture URL parameters or insert them into forms. Just before the
Open Source Agenda is not affiliated with "Sup Save Url Parameters" Project. README Source: gkogan/sup-save-url-parameters
Stars
84
Open Issues
1
Last Commit
11 months ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating