← All examples

JavaScript Productivity analytics.google.com

Highlight rows above a threshold

Asks for a threshold value and highlights in green every GA4 row whose first numeric column reaches it.

Code to copy

(function () {
  var input = prompt('Highlight rows where the first numeric column is at least:', '1000');
  if (input === null) return;
  var min = parseFloat(input.replace(/[^\d.]/g, ''));
  if (isNaN(min)) return;
  document.querySelectorAll('[role="row"], tbody tr').forEach(function (row) {
    var cell = row.querySelector('[role="cell"], [role="gridcell"], td');
    if (!cell) return;
    var n = parseFloat((cell.textContent || '').replace(/[^\d.]/g, ''));
    if (!isNaN(n) && n >= min) {
      row.style.setProperty('background', 'rgba(52,168,83,0.15)', 'important');
      row.style.setProperty('font-weight', '600', 'important');
    }
  });
})();

How to use this example

  1. Copy the code with the button above.
  2. Install JustZix (2 minutes) and open the extension on the target page.
  3. Add a new rule matching that page.
  4. Paste the code into the rule's JavaScript panel and save — it runs on every page visit.

Rate this example

No ratings yet — be the first.

Does this example work?

Snippets are useless without somewhere to paste them.

JustZix takes 2 minutes to install and runs your code on every matching page. No account, no payment.

Download free See use cases