ShimmerCat comes with a built-in JS agent, which is an async JS script that can be inserted in HTML contents. The purpose of the script is to collect performance metrics to show in the customer's dashboards, and to assess the efficacy of acceleration measures.
How the JS snippet is inserted
When configured, the snippet is inserted by injecting the following fragment in the HTML code:
The exact place where the
<script> tag is inserted in the HTML stream
is configured in each HTML-transacting view, as discussed in the next
Inserting the script
To insert the script, a fragment like the following one needs to be added to views that have "content-disposition: replace" and that traffic HTML:
<!-- shimmercat: content-disposition: replace change-url: - / -> /fastcgi_0.php sc-snippet-after: - "</body>\\n" -->
New here is the array under
This array should contain HTML fragments close to the end of the main HTML document;
ShimmerCat will insert the snippet right after the first of the given fragments which
is found in the HTML document.
By carefully selecting the view(s) and the snippets in the
you can control when and where the script tag is inserted.
ShimmerCat uses literal string matching and the Aho-Corasick algorithm to find
matches for the array of literals under
The Aho-Corasick algorithm creates a deterministic automaton that can match all
the patterns simulateneously in a very efficient way.
Furthermore, ShimmerCat compiles this automaton straight to machine code and stores
a cached dynamic link object under
t-cache in the scratch folder.