Segment keywords by number of words in GA

/ Published in: Regular Expression
Save to your folder(s)

Copy this code and paste it in your HTML
  1. ^[^\s]*$ matches exactly 1-word keyword
  2. ^[^\s]*\s[^\s]*$ matches exactly 2-word keyword
  3. ^[^\s]*\s[^\s]* matches keywords of at least 2 words (2 and more)
  4. ^([^\s]*\s){2}[^\s]*$ matches exactly 3-word keyword
  5. ^([^\s]*\s){4}[^\s]*$ matches 5-words-and-more keywords (longtail)

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.