Product rules are incredibly powerful in eesel. You can specify which url patterns you want to track and which you don't using a special rule 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:// or http:// 
  • Domains and subdomains like docs.google.com which use .  as the delimiter
  • A path like /document/d  which use /  as the delimiter
  • Query params like ?queryA=1&queryB=2 which use ?  as the first delimiter and &  subsequently
  • Fragments 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 fragments
  • An 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/  tracks https://www.example.com and not https://example.com (as *  makes it mandatory to have at least one item)
  • https://**.example.com  tracks https://example.com, https://www.example.com and https://www.abc.example.com 
  • https://example.*  tracks https://example.com  and https://example.io 

Examples for paths using / as the delimiter

  • https://example.com/*  tracks https://example.com/abc and doesn't track https://example.com 
  • https://example.com/** tracks https://example.com, https://example.com/abc,  https://example.com/abc/def  

Examples for query params using ? as the delimiter

  • https://example.com/abc?* tracks https://example.com/abc?x=1 and not https://example.com/abc 
  • https://example.com/abc?** tracks https://example.com/abc, https://example.com/abc?x=1 and https://example.com/def?x=1&y=2, 

Examples for fragments using # as the delimiter

  • https://example.com/#* tracks https://example.com/#x=1 and not https://example.com  
  • https://example.com/#** tracks https://example.com, https://example.com/#x=1 and https://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 consider https://google.com, https://slides.google.com and so on as Google Docs.
  • /* specifies that we absolutely expect some kind of doc identifier (like 1cMLTVBv1zJn6dxA12d9eZVA_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 product rules as this is a 'catch all' pattern for paths, query params and fragments.

That's it 🎉! Have a look at some product rules of managed products to get a feel of different patterns. You can always just reach out to us via Intercom if you're stuck :)

Did this answer your question?