# `webflow-form-decorators`

Decorate Webflow forms with dynamic fields (such as referral info and url
submitted).

## Usage

To use, simply include `webflow-form-decorators.js` in your website's head tag to
expose the global `webflowFormDecorators` object with various utility methods.

Currently `webflowFormDecorators` exposes a single function,
`appendDynamicFieldsToAllForms`, which appends a single `url` hidden field to
all Webflow forms on the page which is populated with the current browser URL:

```javascript
webflowFormDecorators.appendDynamicFieldsToAllForms();
```

`appendDynamicFieldsToAllForms` takes an optional `ReferalTracker` instance
(see (@ivcmedia/referral-tracker)[https://www.npmjs.com/package/@ivcmedia/referral-tracker]).
If provided, this function also appends hidden inputs for capturing referral
information (in particular fields named "landing_page_url", "referrer",
"utm_campaign", "utm_source", "utm_content", "utm_term", and "utm_medium"):

```javascript
const referralTracker = new ReferralTracker();
webflowFormDecorators.appendDynamicFieldsToAllForms(referralTracker);
```
