aboutsummaryrefslogtreecommitdiff
path: root/README.org
blob: 84be873e45975af11cdac421bce6c0816e8f383d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#+title: traclicker
#+author: Yuchen Pei <id@ypei.org>

* Introduction
  :PROPERTIES:
  :UPDATED:  [2023-10-30 Mon 00:27]
  :END:

A click tracker is a recipient-specific link in email newsletters
which when clicked, registers the click with the sender's server and
gets the real link through HTTP redirect (301/302). On top of the info
that a server gains from a GET request like IP address and time of the
request, the email sender's server can also identify the email
recipient who clicked the link because each recipient receives a
unique link, and there are few ways to defend against such
identification.

Click trackers are a violation of privacy regardless of how the sender
of the email tries to justify it. This project, ~traclicker~ is a
program that aims to mitigate the privacy risk from click trackers, by
automatically sending a HEAD request to all links and collecting the
real urls, and at the time when the recipient actually reads the
mails, showing the real urls.

* Usage
  :PROPERTIES:
  :UPDATED:  [2023-10-30 Mon 00:26]
  :END:

Add to ~load-path~ and ~require~.

#+begin_src emacs-lisp
(add-to-list 'load-path "~/.emacs.d/lisp/traclicker")
(require 'traclicker)
#+end_src

Configure the maildir boxes (directories with =cur=, =new= and =tmp=
sub-directories) and senders of emails you want to scan and replace
click trackers with real links:

#+begin_src emacs-lisp
(setq tracli-senders '("info@some-org.com"
                       "newsletter@another-org.com"))
(setq tracli-maildirs '("~/mail/Inbox" "~/mail/Archive"))
#+end_src

You are ready for an initial scan now. To do an initial scan of all
mails in these maildirs by these senders, do ~M-x tracli-scan~.

To do an initial scan of emails from say the past 30 days, do the
following

#+begin_src emacs-lisp
(tracli-scan
 (format "%d"
         (- (string-to-number (format-time-string "%s" (current-time)))
            (* 60 60 24 30))))
#+end_src

Alternatively, to do a symbolic scan of emails that just initialises
an empty database with the current time stamp for future scans, do

#+begin_src emacs-lisp
(tracli-scan (format-time-string "%s" (current-time)))
#+end_src

You now have a database at ~tracli-db-file~. You can then run
~tracli-scan~ periodically

#+begin_src emacs-lisp
(setq my-tracli-timer
	    (run-at-time
	     "07:00am"
	     86400 #'tracli-scan))
#+end_src

or as a hook after running say ~gnus-group-get-new-news~

#+begin_src emacs-lisp
(add-hook 'gnus-after-getting-new-news-hook #'tracli-scan)
#+end_src

Whenever you view a mail containing click trackers recorded in
traclicker database, run ~M-x tracli-wash-gnus-article~ (by default
bound to ~v t~ in gnus-summary-mode or gnus-article-mode), and all the
click tracker urls are replaced by the real urls!

Note that the real urls may still contain tracking query parts like
utm parameters, but the cleaning of these urls is feasible by hand,
and a package that does so automatically belongs to a separate project
:D

* Copyright and contact
  :PROPERTIES:
  :UPDATED:  [2023-10-29 Sun 19:15]
  :END:

~tracklicker~ is maintained by Yuchen Pei <id@ypei.org> and covered by
[[https://www.gnu.org/licenses/agpl-3.0.en.html][GNU AGPLv3+]]. You may find the license text in a file named
COPYING.agpl3 in the project tree. For comments, bug reports or
patches, please use the mailing list [[https://lists.sr.ht/~ycp/gym][~ycp/gym@lists.sr.ht]].