← All examples

JavaScript Reading & focus business.facebook.com

Mark CPM and CPC columns

Tints the cost-per-mille and cost-per-click columns yellow so you compare ad efficiency at a glance.

Code to copy

(function () {
  function mark() {
    try {
      document.querySelectorAll('[role="columnheader"]').forEach(function (h, i) {
        var t = (h.textContent || '').toLowerCase();
        if (!/cpm|cpc|cost per click|cost per 1/.test(t)) return;
        h.style.background = 'rgba(255,193,7,0.22)';
        document.querySelectorAll('[role="row"]').forEach(function (r) {
          var c = r.querySelectorAll('[role="gridcell"],[role="cell"]')[i];
          if (c) c.style.background = 'rgba(255,193,7,0.10)';
        });
      });
    } catch (e) {}
  }
  mark();
  setInterval(mark, 3000);
})();

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