App rules are used in eesel to define which pages to show or to ignore based on their URLs. For instance, you might want to only show Github issues but ignore Github discussions in eesel. This can be done by customising the app rules for Github.
App rules are incredibly powerful and are defined with a special notation based on glob patterns. For instance, to start tracking every page for Google Docs, the pattern would be: https://docs.google.com/document/d/*/**?**#/**?**
What does this mean? Let's read on.
What is a URL?
For the purpose of this, you just need to loosely understand that a URL has:
A scheme and protocol like
https://
orhttp://
Domains and subdomains like
docs.google.com
which use.
as the delimiterA path like
/document/d
which use/
as the delimiterQuery params like
?queryA=1&queryB=2
which use?
as the first delimiter and&
subsequentlyFragments like
#fragmentA=1&fragmentB=2
which use#
as the first delimiter and&
subsequently
Pro tip
Paths and query params can come both before and after fragments.
Rule syntax
The main notations are as follows:
.
is the delimiter for domains/
is the delimiter for paths?
is the delimiter for query params#
is the delimiter for fragmentsAn
item
is a string of characters along with a delimiter*
matches one item**
matches 0 or multiple items
Let's apply all this.
Examples for domains using . as the delimiter.
https://*.example.com/
trackshttps://www.example.com
and nothttps://example.com
(as*
makes it mandatory to have at least one item)https://**.example.com
trackshttps://example.com
,https://www.example.com
andhttps://www.abc.example.com
https://example.*
trackshttps://example.com
andhttps://example.io
Examples for paths using / as the delimiter
https://example.com/*
trackshttps://example.com/abc
and doesn't trackhttps://example.com
Examples for query params using ? as the delimiter
https://example.com/abc?*
trackshttps://example.com/abc?x=1
and nothttps://example.com/abc
Examples for fragments using # as the delimiter
https://example.com/#*
trackshttps://example.com/#x=1
and nothttps://example.com
https://example.com/#**
trackshttps://example.com
,https://example.com/#x=1
andhttps://example.com/#x=1&y=2
Putting it all together for Google Docs
Google Docs have urls like https://docs.google.com/document/d/1cMLTVBv1zJn6dxA12d9eZVA_N7IR2cxKZxzVytBnDe2pE/edit#heading=h.6sxwkvhv1drt
Let's try to understand why https://docs.google.com/document/d/*/**?**#/**?**
matches this.
Breaking it down:
https://docs.google.com/document/d/
is how all Google Doc urls start. By doing this we ensure that we don't wrongly considerhttps://google.com
,https://slides.google.com
and so on as Google Docs./*
specifies that we absolutely expect some kind of doc identifier (like1cMLTVBv1zJn6dxA12d9eZVA_N7IR2cxKZxzVytBnDe2pE
in the url example above). All Google Docs have this./**
is to match 0 or any number of path items (so/
,/edit
,/view
and so on)?**
is to match 0 or any number of query items (so no query param,?abc=1
,?abc=1&def=2
and so on). Note: the example url doesn't have any query params.#**
is to match 0 or any number of fragment id items (so no fragment,#heading=h.6sxwkvhv1drt
and so on)./**?**
is to match 0 or any number of more path and query param items that can appear after the fragments
Pro tip
You'll notice that we often use the /**?**#/**?**
in our managed app rules as this is a 'catch all' pattern for paths, query params and fragments.
That's it 🎉! Have a look at some app rules of managed apps to get a feel of different patterns. You can always just reach out to us via Intercom if you're stuck :)