Shoora
10/3/2018 - 3:51 PM

Get a list of individual organic search keywords, sorted by frequency, from the Google Analytics UI

Get a list of individual organic search keywords, sorted by frequency, from the Google Analytics UI

// step 1: Open Google Analytics to Traffic Sources => Sources => Search => Organic
// step 2: Change "Show rows" field to 500
// step 3: Open the JS console, and run the following script

var s = document.createElement('script'); s.src = '//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'; document.getElementsByTagName('body')[0].appendChild(s);
var text = jQuery('td.sf span').map(function(i, el) { return jQuery(el).text(); });

// step 4: Then run this one:

var words = {};
for (var i=0; i<text.length; i++) {
  var w = text[i].split(' ');
  for (var wi=0; wi<w.length; wi++) {
    if (!words[w[wi]]) words[w[wi]] = 0;
    words[w[wi]]++;
  }
}
var sorted = [];
for (var keyword in words) sorted.push([ keyword, words[keyword] ]);
sorted.sort(function(a, b) { return b[1] - a[1]; });