google analytics - regular expression

11

Click here to load reader

Upload: banyapon-poolsawasd

Post on 01-Nov-2014

1.603 views

Category:

Technology


0 download

DESCRIPTION

Regular expressions are special characters that match or capture portions of a field, as well as the rules that govern all characters. Most of the filters included in Google Analytics use these expressions to match the data and perform an action when a match is achieved.

TRANSCRIPT

Page 1: Google Analytics - Regular Expression

ì  Google  Analytics  Regular  Expression  

If  so,  it’s  5me  for  you  to  learn  about  Regular  Expressions  and  how  Google  Analy5cs  uses  them.  

By  @daydev  –  Banyapon  Poolsawasd  

Page 2: Google Analytics - Regular Expression

ì  Google  Analytics  Regular  Expression  

In  Google  Analy5cs,  you  can  use  Regular  Expressions  to  create  filters.  Many  filters  require  Regular  Expressions.  If  you  don’t  know  what  filters  are,  you  can  start  learning  about  them  here.    create  one  goal  that  matches  mul5ple  goal  pages.  Perhaps  your  “thank  you”  page  has  many  names,  but  to  you,  all  leads  are  the  same    goal.  So  you  can  use  Regular  Expressions  to  “roll  them  up.”    fine-­‐tune  your  funnel  steps  so  that  you  can  get  exactly  what  you  need.  Remember,  Regular  Expressions  can  be  specific.  

By  @daydev  –  Banyapon  Poolsawasd  

Page 3: Google Analytics - Regular Expression

ì  Google  Analytics  Regular  Expression  

Start  a  Regular  Expressions  A  Backslash  “\”    A  backslash  “escapes”  a  character  If  Goal  URL  is  /folder?pid=123    

How  to  The    ques5on  mark  already  has  another  use  in  Regular  Expression  rule.  We  can  do  it  like  this:  /folder\?pid=123  

1st  

By  @daydev  –  Banyapon  Poolsawasd  

Page 4: Google Analytics - Regular Expression

ì  Google  Analytics  Regular  Expression  

                           The  pipe  (tube)  “|”  is  the  simplest    of                                  Regular  Expressions  User  for  a  Goal                                      Set1  or  Set2.    (|  =  OR)    

Example  Coke|Pepsi  is  mean  Google  Analy5cs      keyword  report  to  find  all  examples  of  searches  that  came  to  their  blog    using  either  the  keyword  Coke  or  the    keyword  Pepsi.    

2nd  

By  @daydev  –  Banyapon  Poolsawasd  

Page 5: Google Analytics - Regular Expression

ì  Google  Analytics  Regular  Expression  

                           dot  “.”  Matches  any  single  character                                (le^er,  number  or  symbol)  

 Example  Place  "."  everywhere  with  regular  expression  .ate  it  will  match  late,  date,  sate,  or  any  four-­‐character  expression  

Expression  Condi3on  input  google.com  it  will  match  google4com,  googlescom,  googledcom  if  you  need  to  find  google.com  only  you  will  used  expression  like  "google\.com"  

3rd  

By  @daydev  –  Banyapon  Poolsawasd  

Page 6: Google Analytics - Regular Expression

ì  Google  Analytics  Regular  Expression  

                           Dollar  sign  “$”  in  regular  expressions  

                             $  Match  to  the  end  of  the  field    Example  suppose  you  have  some  pages  that  end  in  "htm"  and  others  in  "html."  

Expression  Condi3on  site$  matches  ending  with  site    but  not  sitescan    

4th   5th  A  Caret  “^”  in  regular  expressions  Requires  that  your  data  be  at  the  beginning  of  its  field  

Example  ^site  matches  sitewhat  but  not  mysite  

Expression  Condi3on  If  you  need  to  find  Goal  URL  "subfolder2/"  in  "/folder1/subfolder2/index.html"  use  regular  expressions  "^/subfolder2"  it  will  match  "subfolder2/index.html"  

can  used  "^/subfolder2/index\.html"    

By  @daydev  –  Banyapon  Poolsawasd  

Page 7: Google Analytics - Regular Expression

ì  Google  Analytics  Regular  Expression  

6th  The  Star  "*"  in  Regular  Expressions  Matches  zero  or  more  of  the  previous  item  

Example  The  default  previous  item  is  the  previous  character.    “goo*gle”  It  will  matches  gooogle,  goooogle,  goooooooooogle  

Expression  Condi3on  The  previous  item  is  defined  as  the  previous  character  aa*rgh.  That  will  match  aargh  and  aaargh  and  aaaaaaaaargh    

7th  The  Dot  Star  ”.*”  There  are  two  Regular  Expressions  that,  when  put  together  

Example  use  "/XXX/.*index\.php"  It  will  match  everything  that  starts  with  XXX/  and  ends  with  index.php  

By  @daydev  –  Banyapon  Poolsawasd  

Page 8: Google Analytics - Regular Expression

ì  Google  Analytics  Regular  Expression  

8th  

A  Plus  Sign  "+"  matches  one  or  more  of  the  former  items,  which,  as  usual,  we’ll  assume  is  the  previous  character  

Just  like  a  star,  except  that  a  plus  sign  must  match  at  least  one  previous  item  

Example  “gooo+gle”  matches  goooogle,  but  never  google.  

9th  

Grouping  Parentheses  “()”  in  Regular  Expressions  work  the  same  way  that  they  do  in  mathema5cs  Use  parenthesis  to  create  an  item,  instead  of  accep5ng  the  default    

Example  Thank(s|you)  will  match  both  Thanks  and  Thankyou  "/folder(one|two)/thank"  It  will  Match  /foldertwo/thanks  /folderone/thank    

By  @daydev  –  Banyapon  Poolsawasd  

Page 9: Google Analytics - Regular Expression

ì  Google  Analytics  Regular  Expression  

10th   square  brackets  "[]"  and  dash  "-­‐"  or  "[-­‐]”  ,use  brackets  to  create  a  list  of  items  to  match  to,  like  [abc]  creates  a  list  with  a,  b  and  c  in  it  

Example  [a-­‐z]  –  all  lower-­‐case  le^ers  in  the  English  alphabet  [A-­‐Z]  –  all  upper-­‐case  le^ers  in  the  English  Alphabet  [a-­‐zA-­‐Z0-­‐9]  –  all  lower-­‐case  and  upper-­‐case  le^ers,  and  digits.    

Grouping  

Use  dashes  "-­‐"  with  brackets  to  extend  your  list,  like  [A-­‐Z]  creates  a  list  for  the  uppercase  English  alphabet  

Note  they  are  not  separated  by  commas.  

By  @daydev  –  Banyapon  Poolsawasd  

Page 10: Google Analytics - Regular Expression

ì  Google  Analytics  Regular  Expression  

11th   Braces  “{}”  repeat  the  last  “piece”  of  informa5on  a  specific  number  of  5mes.  

Example  IP  address  –  they  ouen  have  a  block  of  numbers.  So  let’s  say  that    their  IP  addresses  go  from  123.145.167.0  through  123.145.167.99  Used:  123\.145\.167\.[0-­‐9]{1,2}  

Not  in  a  Document  

such  as  {x,y},  it  means,  repeat  the  last  “item”  at  least  x  5mes  and  no  more  than  y  5mes  

Braces  are  not  covered  in  the  Google  Analy5cs  documenta5on,  but  they  are  supported    

By  @daydev  –  Banyapon  Poolsawasd  

Page 11: Google Analytics - Regular Expression

ì  Google  Analytics  Regular  Expression  

Thank  You  for  A^en5on  

By  @daydev  –  Banyapon  Poolsawasd