• Save
Implementing Google Analytics in WordPress
Upcoming SlideShare
Loading in...5
×
 

Implementing Google Analytics in WordPress

on

  • 465 views

Standard Google Analytics code tracks page views. Businesses need more. Learn about tracking behavior on a WordPress site, and how to set up Google Analytics to help you be successful at proving ...

Standard Google Analytics code tracks page views. Businesses need more. Learn about tracking behavior on a WordPress site, and how to set up Google Analytics to help you be successful at proving business value for your site.

Statistics

Views

Total Views
465
Views on SlideShare
464
Embed Views
1

Actions

Likes
2
Downloads
0
Comments
0

1 Embed 1

http://www.linkedin.com 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Implementing Google Analytics in WordPress Implementing Google Analytics in WordPress Presentation Transcript

  • WordPress  Developers  &  Analy2cs  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Do  You  Track  Hits?   Or  Behavior?  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Behavior  MaBers  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Analy2cs  Should  Go  Beyond  Hits   •  Default  code  tracks  pageviews   •  Customiza2on  requires  knowledge  of  JavaScript,  regex,  and   implementa2on   •  E-­‐commerce  tracking   •  Behavioral  tracking/Events   •  Customizing  data  collec:on  for  web  and  mobile  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Easy  Ways  To  Screw  Up  Measurement   •  Use  the  wrong  code/implementa:on   •  Put  your  code  in  the  wrong  place   •  Duplicate  analy:cs  code  on  pages   •  Limit  ability  to  add  tags  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Don’t  Screw  Up  Measurement  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Here’s  How:   1.  Know  Your  Analy2cs  Version   2.  Upgrade  Wisely   3.  Set  Up  Access  Appropriately   4.  Put  the  Code  Where  It  Belongs   5.  Simplify  Tag  Management   6.  Track  Behavior  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Know  Your  Analy2cs  Version  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Google  Analy2cs  Versioning   Universal  Analy2cs  is  the  upgrade  path   for  Google  Analy2cs.   •  Brought  out  of  Beta  on  April  2,  2014   •  Offers  feature  parity  with  Classic   Analy:cs,  with  more  customiza:on   possible   •  Uses  new  library  (analy:cs.js  vs.  ga.js)  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Universal  vs.  Classic  Code   Classic  Code:     <script  type="text/javascript">        var  _gaq  =  _gaq  ||  [];      _gaq.push(['_setAccount',  'UA-­‐XXXXXXXX-­‐1']);      _gaq.push(['_trackPageview']);        (func:on()  {          var  ga  =  document.createElement('script');  ga.type  =   'text/javascript';  ga.async  =  true;          ga.src  =  ('h^ps:'  ==  document.loca:on.protocol  ?   'h^ps://ssl'  :  'h^p://www')  +  '.google-­‐analy:cs.com/ ga.js';          var  s  =  document.getElementsByTagName('script')[0];   s.parentNode.insertBefore(ga,  s);      })();     </script>   Universal  Code:     <script>      (func:on(i,s,o,g,r,a,m) {i['GoogleAnaly:csObject']=r;i[r]=i[r]|| func:on(){      (i[r].q=i[r].q|| []).push(arguments)},i[r].l=1*new   Date();a=s.createElement(o),      m=s.getElementsByTagName(o) [0];a.async=1;a.src=g;m.parentNode.insertBef ore(a,m)      })(window,document,'script','//www.google-­‐ analy:cs.com/analy:cs.js','ga');        ga('create',  'UA-­‐XXXXXXX-­‐X',  ’domain.com');      ga('send',  'pageview');     </script>  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Other  Differences  –  Universal  &  Classic   Improvements  offered  in  Universal  Analy2cs:   •  Timeout  Handling:  In  Universal,  you  can  more  easily  make  GA   session  expira:ons  match  site  seings.   •  Custom  Search  Engines:  Add  search  engines  you  want  to  count  as   organic  traffic  in  the  UA  console.   •  Referral  Exclusions:  Exclude  traffic  referring  from  third-­‐party   processes  via  the  analy:cs.js  tracking  code.   •  Enhanced  Link  ABribu2on:  Improves  accuracy  of  in-­‐page  analy:cs   by  automa:cally  differen:a:ng  between  mul:ple  links  to  the   same  URL  on  a  single  page  by  using  link  element  IDs.  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Upgrade  Wisely  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Classic?  Universal?       •  New  accounts  will  eventually  need  to  be  Universal,  but  op:on  for   classic  s:ll  exists.   •  If  site  is  using  AdSense,  Display  Adver:sing  Integra:on  or   Remarke:ng  Integra:on,  consider  wai:ng.   •  If  the  site  will  require  cross-­‐domain  or  subdomain  tracking,   Universal  is  easier  to  manage.   •  If  you  want  to  track  user  behaviors,  Universal  offers  easier  user   behavior  tracking  (events)  and  greater  customiza:on.   •  Many  WordPress  Plug-­‐ins  do  not  have  established  compa:bility   with  Universal  analy:cs,  including  the  super-­‐popular  Yoast  series.  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Upgrade  Process   1.  Sign  into  Google  Analy:cs.  From  Admin  page,  select  the  account   and  property  you  want  to  upgrade.   2.  In  the  property  column,  click  Universal  Analy:cs  Upgrade.   3.  In  the  sec:on  called  Transfer  to  Universal  Analy:cs,  click   Transfer.  Follow  instruc:ons.   4.  Allow  24-­‐48  hours  for  transfer  to  finish.  Comple:on  will  be  noted   in  the  account.   5.  Modify  tracking  code  on  web  site.  Be  sure  to  remove  all   instances  of  ga.js!  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Upgrade  Process  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Set  Up  Access  Appropriately  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Setup  &  Access   DO:   •  Use  exis:ng  GA  account  if  possible   •  Ensure  each  new  client  is  set  up  as  an  Account  in  Google  Analy:cs   –  not  a  property  under  your  agency/personal/whatever   •  Add  users  (including  yourself)  via  User  Management     DON’T:   •  Set  up  only  on  your  own  or  a  personal  e-­‐mail   •  Give  everyone  and  their  brother  Admin  access  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Google  Analy2cs:  Account  Structure   Account:   Who  is  the  client?   Property:   What’s  their  URL?   View:   Repor2ng  Filters  &  Func2ons  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Access  Levels   Not  everyone   needs   Manage/Edit  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Put  Your  Code  Where  It  Belongs  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Placement  MaBers   Most  Analy2cs  operates  using  JavaScript:   •  Poorly  formed  JavaScript  can  cause  any  later  js  not  to  fire.   •  If  analy:cs  code  does  not  fire,  traffic  is  not  tracked.   •  If  a  user  leaves  the  page  quickly,  a  heavy  body  will  prevent  the  firing  of   code  in  the  footer.   •  If  a  Google  Analy:cs  property  code  fires  twice,  tracking  is  inaccurate.   Ac2ons:   •  Debug  your  JavaScript.   •  Ensure  analy:cs  code  loads  in  header  or  via  an  approved  tag  container.   •  Ensure  Google  Analy:cs  property  code  appears  only  once.   (UA-­‐8794982-­‐1  and  UA-­‐8794982-­‐2  are  unique  property  codes).  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Simplify  Tag  Management  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Tags:  Not  JUST  Google  Analy2cs!  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Tag  Containers   Container  tags  are  tags  that  you  place  on  your  site  that  allow  one   tag  to  trigger  many  other  tags.  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Tag  Containers   Tag  containers  generate  one  code  to  fire  all  of  the  marketers’   pixels  and  hoo-­‐hoo:     <!-­‐-­‐  Google  Tag  Manager  -­‐-­‐>   <noscript><iframe  src="//www.googletagmanager.com/ns.html?id=GTM-­‐ PQT5KQ"   height="0"  width="0"  style="display:none;visibility:hidden"></iframe></ noscript>   <script>(func:on(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':   new  Date().getTime(),event:'gtm.js'});var  f=d.getElementsByTagName(s)[0],   j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=   '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);   })(window,document,'script','dataLayer','GTM-­‐PQT5KQ');</script>   <!-­‐-­‐  End  Google  Tag  Manager  -­‐-­‐>    
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Google  Tag  Manager   hBps://www.google.com/tagmanager   •  Uses  a  single  tag  a|er  open  <body>  tag   •  Allows  for  rule-­‐driven  management  of  all  tags  on  a  page-­‐specific   basis  via  GTM  interface     •  Keeps  agencies  OUT  of  your  code/theme  files   •  Fires  tags  asynchronously   •  Offers  debug  op:ons  and  version  control   •  Works  with  both  Classic  and  Universal  Analy:cs  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Google  Tag  Manager:  Caveats   •  Current  Plug-­‐ins:  Have  issues.   •  Most  plug-­‐ins  inject  in  wrong  spot  unless  you  hack  the  plug-­‐in.   Test  before  commiing  to  a  plug-­‐in.   •  In  absence  of  a  plug-­‐in…  may  have  to  :e  to  a  theme  via  the   header.php  tag.  Add  code  a|er  <body>.   •  Duplica2ng  Code:  Either  put  Google  Analy:cs  in  GTM,  or  in   another  plug-­‐in  container.  Not  both!  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Alternate  Tag  Management  Tools   •  Qubit  –  free  for  up  to  1MM  server  calls/monthly.  Uses  W3C  open   data  standard.  WordPress  Plugin  available.   •  Storm  Tag  Manager  –  free  on  Storm  CDN  for  sites  with  less  than   5M  page  views  per  month;  pricey  unless  you  self-­‐host  above  5M.   No  Plugin  available.  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Track  Behavior  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   What  is  Event  Tracking?   Events  are  user  interac:ons  with  content  that  can  be  tracked   independently  from  a  web  page  or  a  screen  load.  Downloads,   mobile  ad  clicks,  gadgets,  Flash  elements,  AJAX  embedded   elements  and  file  downloads  are  all  examples  of  ac:ons  you   might  want  to  track  as  Events.   tl:dr:  Event  tracking  tracks   behaviors  not  page  views.  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Implementa2on:   •  Determine  elements  for  which  you  want  to  track  behavioral  data   •  Knowing  what  you  want  to  track  helps  name  and  scale  your   structure  (categories,  actual  ac:ons  and  labels)   •  Plan  Event  Tracking  repor2ng  with  your  user(s)   •  Allows  to  create  meaningful  names  in  category  and  event  calls   •  Adopt  clear  naming  conven2ons   •  Your  variable  names  for  categories,  ac:ons  &  labels  will  appear   in  repor:ng;  category/ac:on  pairs  are  unique  elements  in   sta:s:cs  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Event  Tracking:  Event  Listeners   Clicks  on  Links:   1.  Add  a  tag  of  type  Event  Listener  >  Link  Click  Listener  in  GTM.  Name  it  “Link  Click   Listener.”  Add  firing  rule  of  “All  Pages.”   2.  Add  a  rule  for  each  link  you  want  to  track.  For  instance,  for  a  click  on   h^p://streets.mn/contact,  rule  would  be  “Contact  Clicks”  and  the  condi:ons  would   be:   {{event}}  equals  gtm.linkclick   {{element  url}}  contains  contact   3.  For  each  link,  add  an  Analy:cs  event  tracking  tag  ((Type:  Classic  or  Universal   Analy8cs;  Track  Type  of  Event)  and  name  it  a|er  the  link  you  are  tracking  (“Analy:cs   Event  –  Contact”).  Add  the  rule  you  created  in  #2  as  the  firing  rule.  Enter  a  Category,   Ac:on  and  Label  for  each  event.   •  Category  “Nav”   •  Ac:on  “Select”   •  Label:  “Contact”   4.  Save  a  version  of  tag  container  and  publish  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Event  Tracking:  Event  Listeners   Form  Submits:   1.  Add  a  tag  of  type  Event  Listener  >  Form  Submit  Listener  in  GTM.  Name   it  “Form  Submit  Listener.”  Add  firing  rule  for  page  from  which  form   submits.   2.  Add  a  rule  (name  it  “Form  Submit”  or  for  specific  form)  with  the   following  condi:on:   {{event}}  equals  gtm.formSubmit   3.  Add  an  Analy:cs  event  tracking  tag  (Type:  Classic  or  Universal  Analy8cs;   Track  Type  of  Event).  Add  the  rule  you  created  in  #2  as  the  firing  rule.   Enter  a  Category,  Ac:on  and  Label  for  each  event.   •  Category  “Form”   •  Ac:on  “Submit”   •  Label:  “Lead  Gen”   4.  Save  a  version  of  tag  container  and  publish    
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Behavior.   Not  Hits.  
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Learn  More  Measurement:   This  Presenta2on:   •  SlideShare:  h^p://www.slideshare.net/JulieKosbab     Google  Analy2cs  (General):   •  Google  Analy2cs  Developer  Guides:  h^ps://developers.google.com/analy:cs/devguides/   •  Google  Analy2cs  Academy:  h^ps://analy:csacademy.withgoogle.com/explorer   •  Google  Analy2cs  Solu2ons  Gallery:  h^ps://www.google.com/analy:cs/gallery     Implement  Universal  Analy2cs:   •  Upgrading  to  Universal  Analy2cs:   h^ps://developers.google.com/analy:cs/devguides/collec:on/upgrade/   •  Event  Tracking  in  Universal  Analy2cs:     h^ps://developers.google.com/analy:cs/devguides/collec:on/analy:csjs/events     Discover  Tag  Managers:   •  Google  Tag  Manager:  h^ps://www.google.com/tagmanager   •  Qubit:  h^p://www.qubitproducts.com/tag-­‐management   •  Storm:  h^p://tagmanager.dc-­‐storm.com/      
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Measure  Without  Google  Analy2cs   •  Jetpack  –  WordPress  offering.  Simple  analy:cs  package.   •  Clicky  –  Real-­‐:me  analy:cs  tool  with  behavioral  tracking  and   heatmaps.     •  Mint  –  Self-­‐hosted  analy:cs  package.  For  those     who  crave  total  data  control.   •  Woopra  –  Offers  standard  analy:cs  +     customer  profiling  and  funnel  and  reten:on     repor:ng.   •  Piwik  –  Open-­‐source,  self-­‐hosted  analy:cs     pla‚orm.    
  • Click  to  edit  Master  text  styles   Second  level   WordCamp  Minneapolis  2014   @betweensta8ons   Ques2ons?