Packages
form_length_conversion
1.0.0
Elixir library and Mix task that groups web forms from a CSV by number of fields and shows views, submissions and conversion rate per group, with the best and worst form in each.
Current section
Files
Jump to
Current section
Files
form_length_conversion
README.md
README.md
# form_length_conversion
Elixir library and Mix task. Give it a CSV of web forms with the number of fields each one shows, its views and its submissions. It groups the forms into short, mid and long buckets by field count and shows per bucket the number of forms, views, submissions and the conversion rate (submissions divided by views, as a percent), plus the best and worst form in each bucket and a total row.
Buckets: short is fewer than `--mid-from` fields (default 4, so 1 to 3), mid is from `--mid-from` up to one less than `--long-from` (default 7, so 4 to 6), long is `--long-from` fields or more. Both limits are set by you, not rules; they must satisfy 2 <= mid-from < long-from. The conversion rate is exact and rounded half up to 2 decimals, and shows n/a when a bucket has no views. Best and worst form are picked by exact conversion rate, ties by form name; forms with 0 views are ignored for best and worst. Extra columns are ignored and each form name may appear once. A missing file, a missing column, a number that is not a whole number, a form with more submissions than views, a duplicate form or no rows stops the run with an error and a non-zero exit.
Part of the [OneGTMLab](https://www.onegtmlab.dev) free GTM tools. Background on the idea: [landing page](https://www.onegtmlab.dev/glossary/landing-page).
## Install
```
{:form_length_conversion, "~> 1.0"} # in mix.exs deps
```
## Use
CSV columns: form, fields, views, submissions. Options: --mid-from 4, --long-from 7.
```
$ mix form_length_conversion sample.csv
forms: 9
bucket fields forms views submissions conversion %
short 1-3 3 1800 200 11.11
mid 4-6 3 2600 199 7.65
long 7+ 3 2500 105 4.20
total 9 6900 504 7.30
best and worst form by conversion rate (forms with 0 views ignored)
short best Form A (12.00%)
worst Form B (10.00%)
mid best Form D (8.00%)
worst Form E (7.00%)
long best Form G (5.00%)
worst Form H (3.00%)
```
## Test
```
mix test
```
Offline, no network calls, no dependencies beyond the language runtime. MIT licensed.