UNPKG

2.71 kBMarkdownView Raw
1# :memo: cxa-track
2
3[![NPM version](https://img.shields.io/npm/v/cxa-track.svg)](https://www.npmjs.com/package/cxa-track)
4[![Build Status](https://github.com/sinedied/cxa-track/workflows/build/badge.svg)](https://github.com/sinedied/cxa-track/actions)
5![Node version](https://img.shields.io/node/v/cxa-track.svg)
6[![Install size](https://packagephobia.now.sh/badge?p=cxa-track)](https://packagephobia.now.sh/result?p=cxa-track)
7[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
8[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
10<img src="https://user-images.githubusercontent.com/593151/69799062-d86c4500-11d2-11ea-8af8-bc9e002ec3d6.png" alt="bit matrix" width="200">
11
12> Convenient CLI to quickly update CxA tracked links
13
14**Features:**
15- Watch mode to automagically catch URLs from clipboard and update them without intervention
16- Batch mode to search & replace tracked URLs directly in text files
17- [Front matter](https://jekyllrb.com/docs/front-matter/) support, using `trackingCode` property if it's defined
18
19## Installation
20
21```sh
22npm install -g cxa-track
23```
24
25## CLI Usage
26
27```sh
28Usage: cxa [options] [<files|URL>]
29
30You can omit the URL argument if you copy one to the clipboard.
31
32Options:
33 -s, --set <tracking-code> Set default tracking code
34 -t, --track <tracking-code> Use specified tracking code
35 -w, --watch Watch clipboard for URLs
36 -h, --help Show this help
37
38Tracking code format (fallback to default for missing values):
39 event
40 event-channel
41 event-channel-alias
42```
43
44### Default tracking code
45
46You should run `cxa -s event-channel-alias` at least once to save your default tracking code.
47
48You will then be able to override it partially or fully using the `-t` options when needed.
49
50### Watch mode
51
52When using `cxa -w` the app will be left open and monitor your clipboard: each time tracked URLs are detected, they will be updated directly in the clipboard so you can just paste them.
53
54> Note that it not only works with a single URL, but also any text containing multiple URLs 😎
55
56### Batch mode
57
58Using `cxa <files>` you can update tracked links in a bunch of text files at once. Only URLs matching tracked domains will be affected, you can see the list [here]().
59
60Using the `trackingCode` property in a [Front matter](https://jekyllrb.com/docs/front-matter/) section of your files, you can use different tracking code per file (partial overrides are supported, like with `-t` option). This property will always have the priority over the `-t` option.
61
62> Note that text files are read and written using `UTF-8` encoding, be careful if you use other encodings!