← All examples

JavaScript Productivity ads.google.com

Dim rows with zero impressions

Fades Google Ads table rows that have zero impressions so you can focus on the active items.

Code to copy

/* Dim rows with zero impressions to focus on active items */
(function () {
  function scan() {
    try {
      var heads = document.querySelectorAll('th, [role="columnheader"]');
      var idx = -1;
      heads.forEach(function (h, i) {
        if (/impr/i.test(h.textContent || '')) {
          idx = Array.prototype.indexOf.call(h.parentNode.children, h);
        }
      });
      if (idx < 0) return;
      document.querySelectorAll('tr, [role="row"]').forEach(function (r) {
        var cell = r.children[idx];
        if (!cell) return;
        var v = (cell.textContent || '').replace(/[^0-9]/g, '');
        if (v === '0' || (cell.textContent || '').trim() === '0') {
          r.style.opacity = '0.5';
        }
      });
    } catch (e) {}
  }
  scan();
  new MutationObserver(scan).observe(document.body, { childList: true, subtree: true });
})();

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