utm_translit 1.0.0
utm_translit: ^1.0.0 copied to clipboard
Build clean UTM-tagged URLs with automatic Cyrillic to Latin transliteration, value normalization and ready channel presets.
utm_translit #
Build clean UTM-tagged URLs with automatic Cyrillic → Latin transliteration, value normalization and ready channel presets. Zero runtime dependencies.
This is the Dart port of the free online UTM generator at nepolyakov.ru. Cyrillic values in UTM tags get percent-encoded into unreadable junk and split your analytics into duplicate channels — this fixes that.
Install #
dependencies:
utm_translit: ^1.0.0
Usage #
import 'package:utm_translit/utm_translit.dart';
void main() {
final url = buildUtm('example.com', {
'source': 'yandex',
'medium': 'cpc',
'campaign': 'Летняя Акция',
});
print(url);
// https://example.com?utm_source=yandex&utm_medium=cpc&utm_campaign=letnyaya_aktsiya
// Channel preset with dynamic placeholders preserved:
print(buildUtm('https://shop.ru/sale', {...preset('yandex'), 'campaign': 'summer'}));
// Normalize a single value:
print(cleanValue('Чёрная Пятница')); // chyornaya_pyatnitsa
}
Options #
buildUtm(url, params, translit: true, lowercase: true, decode: true);
Presets: yandex, google, vk, telegram, email.
Related #
- Free online UTM generator — the no-code web version.
- Marketing engineering tools by the same author.
- About the author — Nikolai Polyakov.
License #
MIT © Nikolai Polyakov