module UtmParameterAudit
Overview
Audit the UTM parameters of a list of links. Pure string work: no network and no URI library. It reads the text of the links you give; it does not open them and does not know which names your analytics tool expects.
Defined in:
utm_parameter_audit.crConstant Summary
-
BAD_CHARS =
"space, + or %20 in utm value" -
CASE_PARAMS =
["utm_source", "utm_medium", "utm_campaign"] of ::String -
CHECKS =
[MISSING_SOURCE, MISSING_MEDIUM, MISSING_CAMPAIGN, EMPTY_VALUE, UPPER_CASE, BAD_CHARS, DUPLICATE, NO_QUERY] -
DUPLICATE =
"same utm parameter twice" -
EMPTY_VALUE =
"empty utm value" -
MISSING_CAMPAIGN =
"missing utm_campaign" -
MISSING_MEDIUM =
"missing utm_medium" -
MISSING_SOURCE =
"missing utm_source" -
NO_QUERY =
"no query string" -
REQUIRED =
["link_id", "url"] of ::String -
UPPER_CASE =
"upper-case letter in utm value" -
USAGE =
"usage: utm-parameter-audit links.csv\nCSV columns: link_id, url. It reads the text of the links you give; it does not open them and does not know which names your analytics tool expects. More: https://www.onegtmlab.dev/blog/the-automated-linkedin-content-distribution-system-for-b2b-business" -
VERSION =
"1.0.0"
Class Method Summary
- .audit(links : Array(Link)) : Report
-
.check(url : String) : Array(String)
The problems of one link, each check at most once.
-
.cli(args : Array(String), stdout : IO, stderr : IO) : Int32
Exit codes: 0 no problem, 1 any problem, 2 unreadable or bad input.
-
.parse_csv(text : String) : Array(Array(String))
Small CSV reader: comma separated, double quoted fields may hold commas, line breaks and "" for a quote mark.
-
.parse_query(query : String) : Array(Tuple(String, String))
Splits a query on "&", each pair on the first "=".
-
.query_of(url : String) : String | Nil
Text before the first "#", then the part after the first "?" (nil when there is no "?").
- .read_links(text : String) : Array(Link)
- .render(r : Report) : String
- .table(rows : Array(Array(String))) : String
Class Method Detail
The problems of one link, each check at most once. A link with no query string reports only that: the missing-parameter checks apply to links that have a query string.
Exit codes: 0 no problem, 1 any problem, 2 unreadable or bad input.
Small CSV reader: comma separated, double quoted fields may hold commas, line breaks and "" for a quote mark. Returns rows of raw cell strings.
Splits a query on "&", each pair on the first "=". Names are lower-cased, values are kept as written. Empty segments are skipped; a pair with no "=" has an empty value.
Text before the first "#", then the part after the first "?" (nil when there is no "?").