SlideShare una empresa de Scribd logo
1 de 143
Descargar para leer sin conexión
 
Google	
  Tag	
  Manager	
  	
  
Not for programmers
	
  
	
  
	
  
	
  
	
  
A	
  quick	
  guidebook	
  to	
  Google	
  Tag	
  Manager	
  for	
  marketers	
  and	
  other	
  
professions	
  not	
  connected	
  with	
  programming.	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
LCS	
  &	
  CSI	
  Poland	
  
Warsaw,	
  2014	
  
	
  
 
	
  
	
  
2	
  
Introduction
	
  
Thank	
  you	
  for	
  your	
  interest	
  in	
  this	
  guidebook	
  to	
  Google	
  Tag	
  Manager,	
  which	
  is	
  more	
  and	
  
more	
  often	
  implemented	
  on	
  websites,	
  across	
  all	
  over	
  the	
  world.	
  The	
  main	
  aim	
  of	
  its	
  
installation	
  is	
  usually	
  for	
  a	
  marketing	
  department	
  to	
  become	
  independent	
  from	
  other	
  
company’s	
  departments	
  (like	
  IT)	
  and	
  to	
  speed	
  up	
  changes	
  on	
  a	
  website	
  within	
  marketing	
  
and	
  analytics	
  measurement	
  processes.	
  	
  
	
  
However,	
  to	
  be	
  able	
  to	
  become	
  really	
  independent,	
  one	
  should	
  know	
  how	
  to	
  use	
  this	
  tool.	
  It	
  
is	
  often	
  connected	
  with	
  technical	
  issues,	
  which	
  may	
  not	
  be	
  very	
  well	
  known	
  to	
  everyone.	
  A	
  
marketer	
  does	
  not	
  have	
  to	
  be	
  a	
  programmer	
  or	
  a	
  technical	
  person,	
  at	
  last.	
  
	
  
An	
  idea	
  has	
  arisen	
  on	
  this	
  field	
  to	
  explain	
  the	
  technical	
  subject	
  to	
  non-­‐technical	
  people	
  in	
  
the	
  least	
  technical	
  way	
  ;).	
  	
  
	
  
Please	
  notice,	
  this	
  guidebook	
  is	
  not	
  official	
  manual	
  approved	
  by	
  Google	
  and	
  does	
  not	
  
include	
  all	
  options	
  and	
  does	
  not	
  describe	
  all	
  possibilities	
  of	
  GTM.	
  It	
  is	
  to	
  give	
  the	
  concept	
  
what	
  you	
  can	
  do	
  with	
  it,	
  understand	
  its	
  working	
  and	
  make	
  use	
  of	
  it	
  in	
  the	
  most	
  popular	
  
cases.	
  A	
  reader	
  can	
  learn	
  more	
  and	
  develop	
  himself	
  in	
  this	
  area,	
  if	
  she/he	
  wants.	
  
	
  
	
  
	
  
All	
  information	
  about	
  mistakes	
  and	
  ideas	
  for	
  additional	
  chapters	
  are	
  welcome	
  J	
  	
  
	
  
Have	
  a	
  comprehensible	
  reading	
  
Przemek	
  Modrzewski	
  
Senior	
  Analytical	
  Lead	
  
 
	
  
	
  
3	
  
Contributors
	
  
	
  
	
  
The	
  e-­‐book	
  was	
  created	
  in	
  cooperation	
  of	
  couple	
  of	
  people	
  from	
  Poland.	
  
Thanks	
  to	
  huge	
  contribution	
  of	
  team	
  members	
  it	
  was	
  possible	
  to	
  write	
  this	
  ebook.	
  	
  
	
  
	
  
Special	
  thanks	
  for	
  help	
  and	
  contribution	
  to:	
  
	
  
	
  
• Mariusz	
  Gąsiewski	
  
• Paweł	
  Matkowski	
  
• Jacek	
  	
  Ewiak	
  
• Piotr	
  Rudnicki	
  
• Maciej	
  Jerzak	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
DISCLAIMER	
  
	
  
This	
  quidebook	
  is	
  NOT	
  any	
  official	
  manual	
  approved	
  by	
  Google.	
  This	
  is	
  private	
  work	
  of	
  
author	
  and	
  contributors.	
  Please	
  don’t	
  treat	
  any	
  statements	
  in	
  this	
  material	
  as	
  official	
  
statement	
  of	
  Google.	
  	
  	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
 
	
  
	
  
4	
  
Table	
  of	
  Contents	
  
Introduction	
  ...........................................................................................................................	
  2	
  
Contributors	
  ...........................................................................................................................	
  3	
  
Tag	
  manager	
  -­‐	
  introduction	
  ....................................................................................................	
  6	
  
How	
  does	
  GTM	
  work	
  ?	
  .............................................................................................................................................................	
  7	
  
Google	
  Tag	
  Manager	
  structure	
  .............................................................................................................................................	
  8	
  
What	
  is	
  a	
  container?	
  ..................................................................................................................................................................	
  9	
  
What	
  are	
  tags?	
  ..........................................................................................................................................................................	
  10	
  
What	
  are	
  rules?	
  .........................................................................................................................................................................	
  10	
  
What	
  are	
  macros?	
  ....................................................................................................................................................................	
  11	
  
Google	
  Tag	
  Manager	
  on	
  the	
  website	
  ...............................................................................................................................	
  12	
  
Google	
  Tag	
  Manager	
  installation	
  –	
  step	
  by	
  step	
  ........................................................................................................	
  12	
  
Step	
  1	
  –	
  Create	
  a	
  GTM	
  account	
  ..........................................................................................................................................	
  12	
  
Step	
  2	
  –	
  Create	
  the	
  first	
  tag	
  .................................................................................................................................................	
  16	
  
Installation	
  of	
  basic	
  scripts	
  on	
  the	
  website	
  ...........................................................................	
  22	
  
Installation	
  of	
  Google	
  Analytics	
  statistics	
  with	
  GTM	
  ...............................................................................................	
  22	
  
The	
  first	
  rule	
  in	
  GTM	
  ...............................................................................................................................................................	
  28	
  
Testing	
  a	
  newly	
  created	
  tag	
  ................................................................................................................................................	
  30	
  
Installation	
  of	
  Google	
  AdWords	
  conversion	
  tracking	
  with	
  GTM	
  ........................................................................	
  33	
  
The	
  first	
  contact	
  with	
  macros	
  in	
  Google	
  Tag	
  Manager	
  ...........................................................................................	
  38	
  
What	
  does	
  the	
  macro	
  consist	
  of	
  and	
  how	
  is	
  it	
  created?	
  ..........................................................................................	
  39	
  
Implementation	
  of	
  Google	
  AdWords	
  remarketing	
  with	
  GTM	
  ..............................................................................	
  40	
  
Google	
  Tag	
  Manager	
  –	
  advanced	
  cases	
  of	
  use	
  .......................................................................	
  45	
  
Data	
  Layer	
  –	
  what	
  is	
  it	
  and	
  what	
  is	
  it	
  used	
  for?	
  .........................................................................................................	
  45	
  
What	
  is	
  Data	
  Layer?	
  ...............................................................................................................................................................	
  45	
  
How	
  does	
  Data	
  Layer	
  look	
  like?	
  .........................................................................................................................................	
  48	
  
Adding	
  variables	
  and	
  values	
  to	
  Data	
  Layer	
  .................................................................................................................	
  49	
  
Event	
  tracking	
  in	
  Google	
  Analytics	
  with	
  GTM	
  ............................................................................................................	
  52	
  
A	
  button	
  click	
  as	
  an	
  event	
  in	
  Google	
  Analytics	
  ............................................................................................................	
  52	
  
More	
  buttons	
  (events)	
  to	
  measure	
  on	
  one	
  website	
  ...................................................................................................	
  63	
  
Measuring	
  the	
  action	
  on	
  the	
  website	
  with	
  virtual	
  pageviews	
  ..............................................................................	
  65	
  
Auto	
  event	
  in	
  GTM	
  (auto	
  event	
  tracking)	
  ..............................................................................	
  69	
  
Auto-­‐tagging	
  in	
  practice	
  (introduction)	
  ........................................................................................................................	
  69	
  
Auto	
  measuring	
  of	
  clicks	
  on	
  the	
  button	
  (link)	
  .............................................................................................................	
  70	
  
A	
  little	
  more	
  about	
  macros	
  in	
  auto	
  events	
  ...................................................................................................................	
  78	
  
Available	
  macros	
  and	
  their	
  possibilities	
  .......................................................................................................................	
  80	
  
Auto-­‐Event	
  Variable	
  ...............................................................................................................................................................	
  81	
  
Macro	
  Constant	
  String	
  ...........................................................................................................................................................	
  83	
  
Macro	
  -­‐	
  Custom	
  Events	
  ..........................................................................................................................................................	
  83	
  
DataLayer	
  Variable	
  .................................................................................................................................................................	
  84	
  
DOM	
  elements	
  ............................................................................................................................................................................	
  84	
  
HTTP	
  referrer	
  ............................................................................................................................................................................	
  87	
  
Javascript	
  Variable	
  (Custom	
  Javascript	
  code)	
  .............................................................................................................	
  87	
  
Random	
  Number	
  ......................................................................................................................................................................	
  88	
  
URL	
  macro	
  ..................................................................................................................................................................................	
  89	
  
 
	
  
	
  
5	
  
Lookup	
  Table	
  .............................................................................................................................................................................	
  90	
  
Measuring	
  outbound	
  links	
  as	
  auto	
  events	
  in	
  GA	
  .......................................................................................................	
  91	
  
Measuring	
  document	
  downloads	
  (e.g.	
  PDF)	
  as	
  auto	
  events	
  in	
  GA	
  .....................................................................	
  94	
  
Measuring	
  clicks	
  on	
  images	
  as	
  an	
  event	
  on	
  the	
  website	
  in	
  GA	
  ............................................................................	
  96	
  
Cross-­‐domain	
  tracking	
  with	
  GTM	
  (UA)	
  ......................................................................................................................	
  100	
  
Dynamic	
  remarketing	
  installation	
  with	
  GTM	
  ..........................................................................................................	
  103	
  
First	
  method	
  -­‐	
  standard	
  .....................................................................................................................................................	
  104	
  
The	
  second	
  method	
  –	
  without	
  sending	
  variables	
  programmistically	
  ............................................................	
  112	
  
Ecommerce	
  tracking	
  in	
  GA	
  with	
  GTM	
  .........................................................................................................................	
  121	
  
Dealing	
  with	
  the	
  bounce	
  rate	
  in	
  Google	
  Analytics	
  (real	
  bounce	
  rate)	
  ...........................................................	
  124	
  
Tags	
  which	
  are	
  not	
  in	
  GTM	
  ..............................................................................................................................................	
  128	
  
Using	
  GTM	
  in	
  mobile	
  applications	
  .......................................................................................	
  132	
  
Administering	
  tags	
  in	
  application	
  –	
  a	
  few	
  words	
  ...................................................................................................	
  132	
  
Introducing	
  changes	
  in	
  application	
  (revolution)	
  ...................................................................................................	
  133	
  
A	
  problem	
  with	
  mobile	
  applications	
  .............................................................................................................................	
  133	
  
How	
  does	
  GTM	
  work	
  for	
  application?	
  ..........................................................................................................................	
  134	
  
What	
  can	
  be	
  changed	
  by	
  GTM	
  in	
  application?	
  .........................................................................................................	
  136	
  
A	
  few	
  final	
  thoughts	
  ...........................................................................................................	
  141	
  
Migration	
  plan	
  to	
  GTM	
  .......................................................................................................	
  142	
  
Conclusion	
  ..........................................................................................................................	
  143	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
 
	
  
	
  
6	
  
Tag manager - introduction
	
  	
  
Tag	
  manager	
  is	
  a	
  tool	
  which	
  makes	
  easier	
  to	
  work	
  with	
  numerous	
  marketing	
  codes	
  which	
  
allow	
  tracking,	
  measuring	
  and	
  also	
  marketing	
  actions	
  for	
  users	
  of	
  our	
  website.	
  
	
  	
  
Thanks	
  to	
  GTM	
  we	
  do	
  not	
  have	
  to	
  edit	
  websites	
  to	
  make	
  any	
  changes	
  or	
  add	
  new	
  marketing	
  
codes.	
  You	
  need	
  only	
  to	
  paste	
  the	
  GTM	
  code	
  once	
  on	
  our	
  website.	
  GTM	
  answers	
  the	
  need	
  of	
  
control	
  of	
  implementation	
  of	
  different	
  codes	
  on	
  the	
  website	
  by	
  marketing	
  not	
  by	
  the	
  IT	
  
department.	
  We	
  know	
  that	
  for	
  running	
  effective	
  marketing	
  in	
  the	
  Internet	
  more	
  and	
  more	
  
tools	
  connected	
  to	
  our	
  website	
  are	
  necessary.	
  	
  
	
  
So	
  far,	
  to	
  introduce	
  anything,	
  change	
  the	
  website	
  in	
  terms	
  of	
  marketing	
  codes,	
  the	
  
intervention	
  of	
  IT	
  department	
  or	
  a	
  webmaster	
  has	
  been	
  necessary.	
  Usually	
  the	
  process	
  was	
  
quite	
  long	
  then.	
  Additionally,	
  lack	
  of	
  understanding	
  how	
  different	
  marketing	
  tools	
  work	
  by	
  
the	
  IT	
  department	
  often	
  caused	
  wrong	
  installations.	
  Another	
  waste	
  of	
  time.	
  	
  
	
  
Thanks	
  to	
  GTM,	
  a	
  marketer	
  or	
  other	
  person	
  responsible	
  for	
  marketing	
  actions	
  in	
  the	
  
Internet	
  can,	
  by	
  their	
  own,	
  in	
  a	
  few	
  minutes,	
  add	
  any	
  code	
  which	
  is	
  needed	
  for	
  different	
  
tools	
  working	
  without	
  the	
  need	
  of	
  contact	
  with	
  the	
  IT	
  department.	
  
	
  
GTM	
  has	
  also	
  many	
  other	
  possibilities,	
  which	
  I	
  will	
  tell	
  about	
  later	
  in	
  this	
  e-­‐book.	
  
	
  
 
	
  
	
  
7	
  
How does GTM work?
	
  
Simply	
  speaking,	
  installing	
  the	
  GTM	
  code	
  once	
  in	
  your	
  service	
  (a	
  code	
  fragment	
  on	
  each	
  
subpage)	
  we	
  can	
  add,	
  edit,	
  delete	
  all	
  marketing	
  tags	
  (remarketing,	
  analytics,	
  conversion	
  
tracking	
  and	
  many	
  others)	
  with	
  no	
  need	
  of	
  editing	
  the	
  website	
  code.	
  All	
  actions	
  take	
  place	
  
with	
  GTM	
  interface	
  in	
  the	
  web	
  which	
  we	
  log	
  in	
  as	
  easy	
  as	
  in	
  mail	
  or	
  Google	
  Analytics.	
  It	
  
gives	
  control	
  over	
  marketing	
  codes	
  for	
  people	
  who	
  are	
  not	
  related	
  to	
  the	
  IT	
  department	
  
while	
  website	
  security	
  will	
  not	
  be	
  at	
  risk.	
  It	
  also	
  significantly	
  shortens	
  time	
  needed	
  for	
  
changes	
  and	
  reaction	
  for	
  changes	
  which	
  are	
  need	
  while	
  running	
  the	
  campaign	
  in	
  the	
  
Internet	
  and	
  reduces	
  a	
  resources	
  (i.e.	
  IT	
  department)	
  needed	
  every	
  day	
  in	
  marketing	
  
actions	
  (website	
  edition,	
  code	
  changes,	
  tag	
  pasting,	
  etc.).	
  	
  
	
  
What	
  is	
  important	
  and	
  should	
  be	
  clear.	
  Switching	
  to	
  GTM	
  not	
  affect	
  any	
  reports	
  and	
  should	
  
not	
  have	
  any	
  impact	
  on	
  data.	
  Of	
  course	
  when	
  implemented	
  correctly.	
  	
  
	
  
	
  
GTM	
  tool	
  consists	
  of	
  several	
  elements,	
  which	
  we	
  will	
  administer:	
  
● Containers	
  i.e.	
  codes	
  pasted	
  on	
  the	
  website	
  in	
  which	
  all	
  marketing	
  codes	
  (tags)	
  will	
  
be	
  stored.	
  	
  
● Tags	
  –	
  tracking	
  codes	
  which	
  we	
  want	
  to	
  place	
  on	
  the	
  website	
  e.g.	
  Google	
  Analytics,	
  
AdWords	
  conversion	
  codes,	
  remarketing	
  and	
  any	
  other	
  tracking	
  codes,	
  not	
  only	
  
these	
  ones	
  from	
  Google.	
  	
  
● Rules	
  –	
  conditions	
  in	
  which	
  tags	
  are	
  to	
  be	
  fired.	
  	
  
● Macros	
  –macros	
  are	
  used	
  for	
  making	
  the	
  work	
  with	
  tags	
  and	
  rules	
  easier,	
  
automating	
  repetitive	
  actions.	
  	
  
	
  
All	
  these	
  elements	
  will	
  be	
  discussed	
  later	
  in	
  this	
  document.	
  
	
  
	
  
 
	
  
	
  
8	
  
Google Tag Manager structure
	
  	
  
An	
  account	
  structure	
  of	
  GTM	
  tool	
  consists	
  of	
  above	
  mentioned	
  containers	
  and	
  tags	
  which	
  
belong	
  to	
  them,	
  as	
  well	
  as	
  rules	
  and	
  macros.	
  	
  
	
  
	
  
	
  
	
  
When	
  creating	
  the	
  GTM	
  account	
  you	
  can	
  see	
  the	
  menu	
  on	
  the	
  left.	
  There	
  are	
  three	
  elements	
  
in	
  it	
  –	
  tags,	
  rules	
  and	
  macros.	
  All	
  tags	
  (marketing	
  codes	
  added	
  to	
  the	
  website	
  by	
  GTM)	
  and	
  
rules	
  and	
  macros	
  created	
  by	
  us	
  will	
  be	
  stored	
  here.	
  Creating	
  each	
  of	
  these	
  items	
  takes	
  place	
  
with	
  the	
  help	
  of	
  menu	
  in	
  the	
  center	
  of	
  interface,	
  where	
  we	
  see	
  button	
  “new”.	
  We	
  have	
  said	
  
in	
  short,	
  at	
  the	
  beginning,	
  what	
  elements	
  of	
  the	
  GTM	
  account	
  are	
  and	
  what	
  they	
  are	
  used	
  
for,	
  now	
  let’s	
  explain	
  this	
  in	
  details.	
  So,	
  once	
  more,	
  what	
  actually	
  containers,	
  tags,	
  macros	
  
and	
  rules	
  are.	
  
	
  
GTM	
  account	
  
Container	
  
Tags	
  
Rules	
   Macros	
  
 
	
  
	
  
9	
  
	
  
	
  
What is a container?
	
  	
  
All	
  tags	
  are	
  stored	
  in	
  the	
  container.	
  The	
  container	
  is	
  a	
  set	
  of	
  all	
  tags	
  which	
  are	
  used	
  and	
  
pasted	
  on	
  the	
  same	
  website	
  with	
  GTM.	
  The	
  container	
  should	
  be	
  pasted	
  on	
  every	
  webpage	
  
of	
  our	
  website,	
  similar	
  to	
  normal	
  tracking	
  code	
  e.g.	
  Google	
  Analytics.	
  Only	
  then	
  we	
  can	
  add	
  
tags	
  of	
  every	
  tracking	
  other	
  tools,	
  e.g.	
  Analytics	
  or	
  Adwords	
  from	
  the	
  level	
  of	
  GTM	
  interface.	
  
	
  
	
  	
  
In	
  this	
  way,	
  we	
  edit	
  our	
  website	
  only	
  once,	
  paste	
  a	
  container	
  in	
  the	
  right	
  place	
  (the	
  best	
  
 
	
  
	
  
10	
  
directly	
  under	
  the	
  tag	
  <body>,	
  which	
  opens	
  website	
  content)	
  and	
  then	
  all	
  other	
  codes	
  are	
  
added	
  to	
  website	
  through	
  the	
  container	
  with	
  no	
  need	
  of	
  interference	
  in	
  a	
  website’s	
  source	
  
code.	
  	
  	
  
	
  
Remember!	
  The	
  container	
  should	
  be	
  installed	
  on	
  each	
  subpage	
  of	
  our	
  service.	
  As,	
  for	
  
example,	
  Analytics	
  code.	
  It	
  is	
  so	
  important	
  that	
  in	
  the	
  case	
  of	
  omitting	
  any	
  subpage	
  there	
  is	
  
no	
  possibility	
  to	
  add	
  tags	
  with	
  GTM	
  on	
  it.	
  That’s	
  why	
  we	
  will	
  not	
  be	
  able,	
  for	
  example,	
  to	
  use	
  
Analytics	
  code	
  on	
  it,	
  if	
  we	
  want	
  to	
  install	
  a	
  tracking	
  code	
  with	
  GTM.	
  
	
  
What	
  are	
  tags?	
  
	
  	
  
Tags	
  are	
  tracking	
  codes	
  which	
  we	
  want	
  to	
  paste	
  on	
  a	
  website	
  with	
  the	
  GTM	
  tool.	
  The	
  Tag	
  is	
  
a	
  script,	
  e.g.	
  Google	
  Analytics	
  that	
  we	
  paste	
  usually	
  in	
  the	
  website’s	
  code.	
  It	
  can	
  be	
  also	
  
AdWords	
  conversion	
  tag,	
  remarketing	
  tag	
  or	
  other	
  marketing	
  tool	
  tag	
  which	
  require	
  adding	
  
some	
  fragment	
  of	
  the	
  code	
  on	
  our	
  website.	
  
	
  
What are rules?
	
  	
  
Rules	
  are	
  nothing	
  else	
  than	
  principles	
  when	
  a	
  given	
  tag	
  is	
  to	
  be	
  fired	
  in	
  the	
  container.	
  For	
  
example,	
  if	
  we	
  added	
  a	
  tag	
  of	
  AdWords	
  conversion	
  tracking,	
  we	
  would	
  not	
  like	
  to	
  fire	
  this	
  
code	
  on	
  each	
  subpage	
  of	
  the	
  service	
  but	
  only	
  on	
  the	
  website	
  which	
  confirms	
  doing	
  a	
  
desired	
  action	
  by	
  visitor	
  –	
  purchase,	
  e-­‐book	
  download,	
  filling	
  in	
  a	
  form,	
  etc.	
  
	
  
Such	
  a	
  website	
  can	
  be	
  determined	
  as	
  a	
  last	
  website	
  in	
  some	
  process	
  to	
  aim,	
  on	
  which	
  it	
  is	
  
information	
  confirming	
  this	
  action,	
  for	
  example	
  “Thank	
  you	
  for	
  purchase”.	
  Its	
  URL	
  address	
  
can	
  look	
  i.e.	
  	
  www.my-­‐website.pl/thankyou.html
	
  
	
  
To	
  count	
  a	
  conversion	
  in	
  AdWords,	
  when	
  someone	
  achieves	
  the	
  end	
  of	
  conversion	
  path	
  and	
  
 
	
  
	
  
11	
  
sees	
  the	
  above	
  website,	
  we	
  must	
  create	
  a	
  rule	
  in	
  GTM	
  which	
  will	
  define	
  a	
  condition	
  of	
  firing	
  
the	
  conversion	
  code.	
  The	
  condition	
  (rule)	
  could	
  say	
  as	
  follows:	
  Fire	
  the	
  Adwords	
  
conversion	
  code	
  when	
  there	
  is	
  a	
  word	
  „thank	
  you”	
  in	
  URL	
  address.	
  In	
  other	
  case	
  the	
  code	
  
will	
  not	
  be	
  fired	
  and	
  the	
  conversion	
  will	
  not	
  be	
  counted.	
  	
  
	
  
What are macros?
	
  	
  
A	
  definition:	
  Macros	
  are	
  the	
  pairs	
  "name-­‐value"	
  whose	
  value	
  is	
  completed	
  in	
  the	
  course	
  of	
  
action.	
  For	
  example,	
  an	
  initially	
  defined	
  macro	
  named	
  “URL”	
  is	
  defined	
  in	
  this	
  way	
  that	
  its	
  
value	
  of	
  actual	
  URL	
  of	
  the	
  website.	
  This	
  is	
  a	
  definition.	
  	
  
	
  	
  
Because	
  macros	
  are	
  a	
  bit	
  more	
  complicated	
  elements	
  we	
  will	
  deal	
  with	
  them	
  a	
  little	
  later	
  by	
  
the	
  way	
  of	
  more	
  advanced	
  use	
  of	
  GTM.	
  They	
  are	
  not	
  required	
  for	
  simple	
  standard	
  
installations	
  but	
  we	
  rather	
  cannot	
  ignore	
  its	
  importance.	
  	
  
	
  
Summary	
  
	
  
So,	
  how	
  can	
  all	
  these	
  elements	
  be	
  easily	
  summarized	
  while	
  explaining	
  their	
  relationships	
  
between	
  them?	
  
	
  
Tags	
  are	
  codes	
  which	
  we	
  want	
  to	
  place	
  on	
  the	
  website	
  (e.g.	
  Google	
  Analytics	
  code),	
  rules	
  
are	
  used	
  for	
  defining	
  when	
  a	
  given	
  tag	
  is	
  to	
  be	
  fired	
  (e.g.	
  GA	
  code	
  is	
  to	
  be	
  fired	
  on	
  all	
  pages),	
  
while	
  macros	
  are	
  used	
  for	
  automating	
  and	
  simplifying	
  work	
  with	
  data	
  which	
  are	
  necessary	
  
for	
  tag	
  and	
  rule	
  working	
  on	
  our	
  website.	
  
 
	
  
	
  
12	
  
Google Tag Manager on the website	
  
	
  	
  
Google	
  Tag	
  manager	
  can	
  be	
  used	
  in	
  the	
  case	
  of	
  most	
  codes	
  which	
  we	
  have	
  to	
  add	
  to	
  our	
  
website	
  to	
  benefit	
  from	
  such	
  mechanisms	
  like	
  statistics	
  of	
  website	
  views,	
  conversion	
  
tracking	
  or	
  other	
  data	
  needed	
  for	
  marketing	
  actions.	
  	
  
	
  
In	
  the	
  following	
  steps	
  we	
  will	
  move	
  to	
  the	
  process	
  of	
  correct	
  installation	
  of	
  GTM	
  on	
  the	
  
website	
  by	
  implementing	
  the	
  most	
  popular	
  tags.	
  Meanwhile,	
  we	
  will	
  explain	
  all	
  functions	
  
and	
  concepts,	
  which	
  may	
  not	
  be	
  clear	
  in	
  official	
  GTM	
  help.	
  
	
  
Google	
  Tag	
  Manager	
  installation	
  –	
  step	
  by	
  step	
  
	
  
	
  
Google	
  Tag	
  Manager	
  installation	
  is	
  very	
  simple	
  and	
  includes	
  few	
  steps.	
  
They	
  are:	
  creating	
  an	
  account,	
  creating	
  a	
  container,	
  settings	
  configuration	
  and	
  installation	
  
of	
  first	
  tags	
  i.e.	
  tracking	
  codes.	
  Although	
  the	
  first	
  actions	
  are	
  quite	
  simple,	
  the	
  questions	
  will	
  
arise	
  just	
  surely	
  at	
  the	
  beginning	
  of	
  actions.	
  I	
  will	
  try	
  to	
  foresee	
  them	
  here	
  and	
  explain	
  ;).	
  
	
  	
  
	
  
Step 1 – Create a GTM account
	
  
This	
  action	
  is	
  very	
  simple.	
  You	
  need	
  only	
  to	
  enter	
  https://www.google.com/tagmanager/
and	
  create	
  an	
  account.	
  
	
  
First	
  container	
  
What	
  a	
  container	
  is	
  we	
  have	
  explained	
  at	
  the	
  beginning	
  of	
  this	
  e-­‐book.	
  Now	
  it	
  is	
  time	
  for	
  its	
  
creation	
  and	
  installation.	
  
	
  
	
  
 
	
  
	
  
13	
  
	
  
	
  
A	
  good	
  practice	
  is	
  just	
  to	
  name	
  a	
  container	
  as	
  we	
  have	
  named	
  our	
  account	
  but	
  it	
  is	
  not	
  
obligatory.	
  Perhaps	
  we	
  will	
  have	
  soon	
  several	
  containers,	
  so	
  it	
  is	
  important	
  to	
  create	
  the	
  
terminology	
  system.	
  The	
  subject	
  of	
  terminology	
  is	
  essential	
  because	
  our	
  account	
  with	
  time	
  
will	
  be	
  bigger	
  as	
  we	
  will	
  add	
  next	
  tags,	
  macros	
  and	
  rules.	
  We	
  will	
  have	
  to	
  know	
  what	
  they	
  are	
  
used	
  for.	
  Then	
  we	
  have	
  to	
  choose	
  where	
  we	
  want	
  to	
  use	
  our	
  container,	
  on	
  a	
  website	
  or	
  in	
  
the	
  mobile	
  application.	
  It	
  is	
  also	
  one	
  of	
  the	
  advantages	
  of	
  GTM	
  that	
  we	
  can	
  use	
  it	
  to	
  
administer	
  tags,	
  and	
  even	
  administer	
  changes	
  in	
  mobile	
  applications.	
  We	
  will	
  write	
  more	
  
about	
  it	
  later.	
  
	
  
	
  
If	
  I	
  have	
  a	
  lot	
  of	
  domains,	
  subdomains,	
  so	
  how	
  many	
  containers	
  do	
  I	
  need?	
  How	
  many	
  
containers	
  should	
  I	
  create?	
  
It	
  was	
  my	
  first	
  question,	
  which	
  came	
  to	
  my	
  mind	
  while	
  creating	
  the	
  first	
  GTM	
  account.	
  
Generally,	
  if	
  I	
  have	
  a	
  lot	
  of	
  domains	
  but	
  they	
  are	
  not	
  connected	
  with	
  one	
  another,	
  it	
  is	
  a	
  
good	
  practice	
  to	
  keep	
  the	
  principle	
  one	
  domain	
  –	
  one	
  account	
  -­‐	
  one	
  container.	
  It	
  allows	
  
keeping	
  an	
  order	
  while	
  it	
  does	
  not	
  disturb	
  to	
  administer	
  them	
  because	
  we	
  can	
  administer	
  a	
  
 
	
  
	
  
14	
  
lot	
  of	
  GTM	
  accounts	
  from	
  the	
  level	
  of	
  one	
  login	
  and	
  password.	
  It	
  is	
  seen	
  on	
  the	
  image	
  below	
  
where	
  with	
  one	
  login	
  I	
  have	
  an	
  access	
  to	
  many	
  GTM	
  accounts.	
  	
  
	
  
	
  
Let’s	
  come	
  back	
  to	
  the	
  installation	
  of	
  the	
  first	
  container.	
  Because	
  actually	
  we	
  implement	
  
GTM	
  on	
  the	
  website,	
  we	
  choose	
  an	
  option	
  of	
  a	
  container	
  just	
  for	
  the	
  website.	
  If	
  we	
  
implement	
  tag	
  manager	
  in	
  application,	
  we	
  will	
  choose	
  a	
  suitable	
  version	
  of	
  “mobile	
  
applications”.	
  
	
  
When	
  choosing	
  a	
  version	
  for	
  a	
  website	
  an	
  available	
  container	
  will	
  occur	
  to	
  be	
  pasted	
  on	
  our	
  
website.	
  	
  
 
	
  
	
  
15	
  
	
  
We	
  copy	
  a	
  ready	
  code	
  of	
  the	
  first	
  container	
  as	
  a	
  whole	
  and	
  paste	
  it	
  on	
  our	
  website.	
  	
  
The	
  best	
  place	
  to	
  paste	
  a	
  container	
  code	
  is	
  a	
  place	
  directly	
  below	
  the	
  tag	
  which	
  opens	
  the	
  
website	
  content	
  -­‐	
  <body>.	
  We	
  will	
  find	
  it	
  easily	
  in	
  the	
  website	
  code	
  by	
  the	
  option	
  “search	
  in	
  
content”.	
  We	
  can	
  see	
  how	
  it	
  looks	
  like	
  for	
  a	
  sample	
  website	
  by	
  clicking	
  the	
  right	
  mouse	
  
button	
  on	
  the	
  website	
  content	
  and	
  choosing	
  “Show	
  the	
  website	
  source”.	
  
	
  
	
  
	
  
	
  
 
	
  
	
  
16	
  
What	
  if	
  we	
  cannot	
  put	
  the	
  GTM	
  code	
  in	
  the	
  place	
  described	
  above?	
  
Remember	
  that	
  the	
  best	
  place	
  for	
  a	
  container,	
  which	
  guarantees	
  the	
  best	
  data	
  collecting,	
  is	
  
the	
  place	
  directly	
  below	
  the<body>	
  tag.	
  	
  
Unfortunately,	
  there	
  is	
  no	
  guarantee	
  that	
  our	
  codes	
  implemented	
  by	
  GTM	
  will	
  be	
  called	
  
correctly	
  if	
  we	
  change	
  the	
  place	
  of	
  the	
  container.	
  Especially	
  I	
  do	
  not	
  recommend	
  pasting	
  the	
  
container	
  code	
  in	
  the	
  <head></head>	
  section	
  because	
  the	
  script	
  includes	
  “iframe”	
  which	
  
can	
  cause	
  an	
  unexpected	
  action	
  of	
  the	
  browser.	
  
	
  
Step 2 – Create the first tag
As	
  we	
  have	
  seen	
  in	
  the	
  image	
  from	
  p.	
  13,	
  after	
  creating	
  the	
  first	
  container	
  we	
  can	
  see,	
  at	
  
once,	
  several	
  built-­‐in	
  tags	
  at	
  our	
  disposal	
  ready	
  to	
  be	
  installed	
  on	
  our	
  website.	
  As	
  you	
  can	
  
see	
  the	
  most	
  popular	
  Google	
  tags	
  are	
  there,	
  we	
  have	
  also	
  available	
  Doubleclick	
  tags.	
  There	
  
are	
  also	
  several	
  tags	
  of	
  other	
  companies	
  available	
  in	
  GTM.	
  In	
  addition,	
  there	
  are	
  custom	
  
tags	
  (Custom	
  HTML)	
  thanks	
  to	
  which	
  we	
  can	
  actually	
  place	
  every	
  other	
  tag	
  on	
  our	
  website,	
  
even	
  if	
  it	
  is	
  not	
  normally	
  on	
  the	
  standard	
  GTM’s	
  tag	
  list.	
  We	
  will	
  discuss	
  implementation	
  of	
  
the	
  most	
  popular	
  tags	
  in	
  details	
  in	
  a	
  moment.	
  Now	
  we	
  will	
  stop	
  for	
  a	
  while	
  and	
  discuss	
  
settings	
  and	
  functionality	
  of	
  the	
  account,	
  which	
  we	
  will	
  use	
  in	
  a	
  while.	
  
	
  
	
  
Settings	
  and	
  functionality	
  of	
  the	
  GTM	
  account	
  
	
  
While	
  creating	
  the	
  GTM	
  account	
  and	
  the	
  first	
  container	
  we	
  have	
  one	
  user	
  (i.e.	
  ourselves).	
  In	
  
GTM	
  account	
  we	
  can	
  add	
  next	
  containers	
  and	
  users.	
  As	
  we	
  can	
  see	
  below	
  we	
  can	
  use	
  the	
  
“New”	
  button	
  and	
  add	
  a	
  user	
  or	
  a	
  container.	
  
	
  
 
	
  
	
  
17	
  
	
  
	
  
	
  
According	
  to	
  what	
  I	
  have	
  written	
  before,	
  a	
  good	
  practice	
  is	
  to	
  keep	
  a	
  rule	
  –	
  one	
  account,	
  one	
  
domain,	
  one	
  container.	
  However,	
  we	
  can	
  ignore	
  this	
  principle	
  in	
  different	
  cases.	
  	
  
	
  
Many	
  domains	
  we	
  treat	
  as	
  the	
  whole.	
  
Then	
  we	
  can	
  use	
  one	
  container	
  for	
  many	
  domains	
  because	
  rules,	
  tags	
  and	
  macros	
  cannot	
  be	
  
divided	
  between	
  containers.	
  If	
  all	
  domains	
  are	
  to	
  be	
  configured	
  in	
  a	
  similar	
  way,	
  the	
  use	
  of	
  
one	
  container	
  is	
  applied.	
  
	
  	
  
	
  Many	
  tags	
  on	
  one	
  domain.	
  
If	
  we	
  have	
  plenty	
  of	
  tags	
  to	
  handle,	
  it	
  is	
  much	
  easier	
  to	
  administer	
  them	
  if	
  we	
  divide	
  them	
  
into	
  two	
  containers	
  or	
  more.	
  It	
  gives	
  us	
  bigger	
  clarity	
  what	
  and	
  when	
  is	
  to	
  be	
  fired	
  and	
  it	
  
makes	
  also	
  that	
  the	
  container	
  itself	
  is	
  less	
  loaded	
  (it	
  is	
  smaller).	
  It	
  is	
  possible	
  to	
  e.g.	
  
segregate	
  tags	
  according	
  to	
  a	
  type	
  and	
  a	
  tool.	
  However	
  it	
  is	
  quite	
  rare.	
  
	
  
 
	
  
	
  
18	
  
Many	
  users	
  with	
  different	
  access	
  rights	
  
Access	
  rights	
  for	
  users	
  can	
  be	
  granted	
  on	
  the	
  container	
  level.	
  Thus,	
  if	
  we	
  want	
  to	
  limit	
  the	
  
access	
  to	
  other	
  domain	
  or	
  tag	
  configuration	
  we	
  have	
  to	
  use	
  more	
  containers	
  and	
  give	
  the	
  
next	
  users	
  access	
  and	
  rights	
  on	
  their	
  level.	
  We	
  can	
  grant	
  accesses	
  of	
  different	
  rights:	
  
browsing,	
  browsing	
  and	
  editing	
  or	
  browsing,	
  editing	
  and	
  publishing	
  (full	
  access)	
  
Test	
  environment	
  
A	
  good	
  idea	
  is	
  to	
  use	
  different	
  containers	
  while	
  testing	
  implementation	
  of	
  new	
  tags	
  or	
  rules.	
  
Especially	
  for	
  big	
  services,	
  a	
  wrong	
  configuration	
  and	
  loss	
  of	
  data	
  for	
  some	
  period	
  can	
  be	
  
painful.	
  	
  Hence,	
  it	
  is	
  worth	
  paying	
  attention	
  to	
  it	
  during	
  implementation.	
  At	
  the	
  moment	
  of	
  
implementation	
  it	
  is	
  a	
  good	
  idea	
  to	
  make	
  use,	
  especially	
  in	
  Google	
  Analytics	
  and	
  other	
  
statistics	
  issues,	
  of	
  the	
  Lookup	
  Table	
  macro,	
  which	
  we	
  will	
  discuss	
  later	
  in	
  this	
  e-­‐book.	
  At	
  
the	
  very	
  end	
  you	
  can	
  find	
  a	
  proposed	
  migration	
  plan	
  to	
  Google	
  Tag	
  Manager.	
  
	
  
"Settings"	
  tab	
  
	
  
In	
  the	
  "settings”	
  tab	
  there	
  is	
  an	
  identifier	
  of	
  a	
  container	
  and	
  a	
  container	
  name,	
  which	
  we	
  
can	
  change	
  in	
  any	
  time.	
  
	
  
"Containers"	
  tab	
  
	
  
In	
  the	
  "Containers"	
  tab	
  we	
  can	
  see	
  currently	
  created	
  containers	
  on	
  the	
  account,	
  number	
  of	
  
tags	
  created	
  for	
  a	
  given	
  container,	
  our	
  rights	
  to	
  edit	
  a	
  container	
  and	
  a	
  number	
  of	
  users	
  
assigned	
  to	
  it.	
  
	
  
Choosing	
  our	
  existing	
  container,	
  which	
  is	
  called	
  "my	
  test	
  container”	
  in	
  our	
  example,	
  we	
  
proceed	
  to	
  the	
  heart	
  of	
  Tag	
  Manager	
  itself	
  i.e.	
  to	
  container	
  settings.	
  
	
  
 
	
  
	
  
19	
  
	
  
	
  
As	
  we	
  can	
  see	
  in	
  the	
  menu	
  on	
  the	
  left,	
  there	
  are	
  tabs	
  concerning	
  tags,	
  rules	
  and	
  macros.	
  We	
  
have	
  said	
  about	
  these	
  elements	
  before	
  and	
  we	
  will	
  talk	
  about	
  them	
  many	
  times	
  further.	
  We	
  
will	
  be	
  using	
  the	
  left	
  menu	
  very	
  often.	
  In	
  the	
  center,	
  we	
  have	
  a	
  view	
  of	
  tags,	
  rules	
  and	
  
macros	
  created	
  by	
  us	
  under	
  grey	
  tabs.	
  
	
  
Now	
  the	
  most	
  important	
  thing,	
  at	
  this	
  point,	
  is	
  to	
  understand	
  the	
  matter	
  of	
  a	
  version	
  
and	
  a	
  container	
  type.	
  So,	
  what	
  is	
  all	
  about?	
  
	
  
Adding	
  a	
  tag	
  or	
  a	
  rule	
  to	
  the	
  container	
  or	
  editing	
  anything	
  in	
  GTM	
  we	
  will	
  not	
  see	
  changes	
  
on	
  our	
  website.	
  Nothing	
  will	
  be	
  changed.	
  To	
  do	
  this	
  we	
  have	
  to	
  publish	
  the	
  changes.	
  Thus,	
  
in	
  item	
  3	
  in	
  the	
  image	
  above	
  we	
  can	
  see	
  a	
  container	
  as	
  unpublished.	
  To	
  publish	
  it	
  and	
  
introduce	
  the	
  changes	
  which	
  will	
  have	
  reflection	
  on	
  our	
  website	
  first	
  we	
  have	
  to	
  create	
  
another	
  version	
  of	
  a	
  container	
  (item	
  2).	
  Then	
  we	
  can	
  publish	
  the	
  current	
  version.	
  It	
  will	
  
then	
  go	
  live.	
  Any	
  created	
  version	
  can	
  be	
  seen	
  below	
  the	
  menu	
  on	
  the	
  left.	
  You	
  can	
  come	
  
back	
  to	
  the	
  version,	
  if	
  there	
  is	
  such	
  a	
  need.	
  Thanks	
  to	
  versions	
  we	
  do	
  not	
  override	
  changes	
  
irretrievably.	
  	
  
	
  
	
  
 
	
  
	
  
20	
  
	
  
	
  
In	
  the	
  image	
  from	
  website	
  17	
  you	
  can	
  see	
  the	
  item	
  1,	
  that	
  is	
  a	
  function	
  of	
  preview.	
  The	
  
“Preview”	
  function	
  is	
  one	
  of	
  functionalities	
  used	
  very	
  frequently	
  while	
  adding	
  or	
  editing	
  
tags	
  or	
  changing	
  other	
  settings.	
  Thanks	
  to	
  the	
  “Preview”	
  function	
  we	
  can	
  preview	
  if	
  
changes	
  introduced	
  by	
  us	
  work	
  properly	
  on	
  the	
  website.	
  There	
  are	
  three	
  options	
  of	
  
preview	
  of	
  changes	
  available.	
  
	
  
	
  
● Preview	
  –	
  It	
  allows	
  us	
  to	
  preview	
  the	
  website	
  with	
  changes	
  applied	
  by	
  us.	
  It	
  means	
  
that	
  after	
  choosing	
  a	
  "Preview”	
  option	
  we	
  can	
  enter	
  our	
  website,	
  refresh	
  it	
  and	
  check	
  if	
  
changes	
  introduced	
  by	
  us	
  work	
  e.g.	
  in	
  the	
  programmers'	
  console	
  in	
  Chrome	
  browser	
  or	
  in	
  
Firebug	
  tool	
  in	
  Firefox.	
  Because	
  we	
  have	
  not	
  created	
  a	
  version	
  in	
  GTM	
  yet,	
  changes	
  on	
  the	
  
website	
  are	
  seen	
  only	
  by	
  us.	
  After	
  switching	
  off	
  the	
  preview	
  option	
  (a	
  yellow	
  bar	
  at	
  top	
  of	
  
the	
  screen),	
  changes	
  will	
  stop	
  working	
  on	
  the	
  website.	
  
	
  
 
	
  
	
  
21	
  
	
  
	
  
	
  
● Debug	
  –	
  the	
  option	
  probably	
  the	
  most	
  frequently	
  used.	
  It	
  allows	
  to	
  add	
  to	
  “Preview”	
  
option	
  an	
  auxiliary	
  console	
  which	
  will	
  show	
  us	
  if	
  and	
  what	
  tags	
  will	
  work	
  on	
  our	
  website	
  
after	
  creating	
  a	
  new	
  version.	
  
	
  
	
  
	
  
	
  
 
	
  
	
  
22	
  
	
  
● Share	
  –	
  A	
  "Share”	
  option	
  allows	
  us	
  to	
  create	
  a	
  unique	
  url	
  address,	
  which	
  we	
  can	
  send	
  
to	
  a	
  person	
  who	
  is	
  not	
  related	
  to	
  our	
  GTM	
  account.	
  Thanks	
  to	
  this	
  address	
  the	
  person	
  who	
  
will	
  use	
  a	
  link	
  given	
  by	
  us	
  will	
  be	
  able	
  to	
  see	
  also	
  working	
  changes,	
  which	
  are	
  not	
  published	
  
yet	
  in	
  GTM.	
  
	
  
	
  
Installation of basic scripts on the website
	
  
We	
  now	
  know	
  the	
  basic	
  settings	
  of	
  Google	
  Tag	
  Manager.	
  We	
  can	
  move	
  to	
  the	
  installation	
  of	
  
tracking	
  scripts	
  on	
  our	
  website	
  with	
  GTM.	
  We	
  will	
  start	
  from	
  the	
  most	
  standard	
  tags	
  
(scripts)	
  and	
  then	
  we	
  will	
  go	
  into	
  more	
  advanced	
  ways	
  of	
  using	
  this	
  tool.	
  
	
  
	
  
Installation of Google Analytics statistics with GTM
	
  
Using	
  Tag	
  Manager	
  (GTM)	
  to	
  track	
  traffic	
  on	
  the	
  website	
  with	
  Google	
  Analytics	
  is	
  one	
  of	
  
most	
  frequent	
  cases.	
  The	
  simplest	
  installation	
  is	
  not	
  complicated	
  but	
  more	
  advanced	
  
aspects	
  of	
  tracking	
  like	
  e.g.	
  event	
  tracking	
  may	
  cause	
  some	
  problems.	
  Thus,	
  we	
  will	
  deal	
  
also	
  with	
  these	
  more	
  advanced	
  aspects	
  in	
  further	
  steps.	
  Now	
  we	
  will	
  make	
  a	
  standard	
  
installation.	
  	
  
	
  
In	
  the	
  previous	
  part	
  of	
  this	
  e-­‐book	
  we	
  have	
  created	
  the	
  GTM	
  account	
  and	
  the	
  first	
  container	
  
as	
  well.	
  Just	
  after	
  creating	
  the	
  container	
  we	
  have	
  an	
  opportunity	
  to	
  move	
  at	
  once	
  to	
  create	
  
the	
  first	
  of	
  the	
  most	
  popular	
  tags.	
  
	
  
 
	
  
	
  
23	
  
	
  
	
  
	
  
We	
  can	
  start	
  to	
  create	
  them	
  at	
  once	
  or	
  do	
  this	
  after	
  installing	
  the	
  container.	
  	
  
We	
  have	
  to	
  do	
  the	
  following:	
  
	
  
1. Create	
  Google	
  Analytics	
  tag	
  	
  
2. Define	
  rules	
  for	
  tag	
  to	
  be	
  fired	
  	
  
3. Test	
  a	
  newly	
  created	
  tag	
  	
  
4. Create	
  a	
  version	
  of	
  the	
  container	
  	
  
5. Publish	
  	
  
	
  
Let’s	
  start	
  from	
  the	
  beginning.	
  
	
  
Ad	
  1.	
  Create	
  Google	
  Analytics	
  tag	
  
	
  
We	
  start	
  creating	
  a	
  tag	
  from	
  giving	
  the	
  name	
  to	
  it.	
  It	
  is	
  important	
  because	
  when	
  there	
  are	
  
many	
  tags	
  it	
  will	
  be	
  easier	
  to	
  administer	
  them	
  if	
  tags	
  have	
  properly	
  matched	
  names.	
  
A	
  good	
  practice	
  is	
  to	
  construct	
  names	
  based	
  on	
  a	
  type	
  of	
  a	
  tool	
  e.g.	
  Google	
  Analytics	
  and	
  a	
  
 
	
  
	
  
24	
  
function,	
  which	
  a	
  given	
  tag	
  is	
  to	
  fulfill.	
  The	
  first	
  tag	
  which	
  we	
  will	
  create	
  is	
  the	
  tag	
  named	
  
GA	
  (Google	
  Analytics)	
  –	
  Pageviews,	
  because	
  this	
  tag	
  will	
  be	
  responsible	
  for	
  tracking	
  
displays	
  of	
  our	
  website,	
  that	
  is	
  a	
  basic	
  function	
  of	
  Google	
  Analytics.	
  All	
  other	
  functions	
  of	
  
GA	
  will	
  be	
  also	
  used	
  but	
  we	
  will	
  use	
  next	
  tags	
  to	
  it.	
  We	
  will	
  talk	
  about	
  it,	
  for	
  example,	
  by	
  the	
  
way	
  of	
  event	
  tracking	
  on	
  the	
  website	
  with	
  GTM.	
  
	
  
	
  
	
  
	
  
Another	
  step	
  is	
  to	
  choose	
  the	
  kind	
  of	
  a	
  tag	
  from	
  the	
  list	
  of	
  standard	
  tags	
  serviced	
  by	
  GTM.	
  
We	
  choose	
  Google	
  Analytics	
  from	
  a	
  pull-­‐down	
  menu.	
  Now	
  we	
  can	
  choose	
  from	
  Classic	
  GA	
  
and	
  a	
  new	
  version	
  that	
  is	
  Universal	
  Analytics.	
  For	
  the	
  need	
  of	
  this	
  example	
  we	
  will	
  use	
  a	
  
classic	
  version.	
  The	
  choice	
  of	
  the	
  second	
  one	
  will	
  not	
  have	
  any	
  influence	
  on	
  the	
  way	
  of	
  
creating	
  and	
  administering	
  the	
  GA	
  tag,	
  so	
  we	
  can	
  choose	
  the	
  version	
  at	
  will.	
  
	
  
 
	
  
	
  
25	
  
	
  
	
  
As	
  you	
  can	
  see	
  above	
  we	
  have	
  many	
  more	
  standard	
  tags	
  available,	
  which	
  we	
  can	
  use	
  with	
  
GTM.	
  If	
  our	
  tag	
  is	
  not	
  on	
  the	
  list	
  we	
  can	
  implement	
  it	
  with	
  custom	
  tags.	
  We	
  will	
  talk	
  about	
  it	
  
later.	
  	
  
	
  
In	
  the	
  next	
  step	
  we	
  have	
  to	
  give	
  an	
  ID	
  number	
  of	
  our	
  account	
  in	
  Google	
  Analytics,	
  which	
  we	
  
are	
  going	
  to	
  install	
  with	
  GTM.	
  We	
  can	
  find	
  ID	
  in	
  our	
  Analytics	
  account.	
  	
  
	
  
***OFF	
  TOPIC***	
  
	
  
As	
  you	
  can	
  see	
  in	
  the	
  image	
  above,	
  on	
  the	
  right	
  next	
  to	
  the	
  ID	
  number	
  of	
  the	
  account	
  
introduced	
  in	
  the	
  "Web	
  property	
  ID”	
  column	
  there	
  is	
  a	
  grey	
  	
  "Lego	
  brick”.	
  This	
  “brick"	
  
indicates	
  the	
  possibility	
  of	
  using	
  macros.	
  I	
  have	
  mentioned	
  before	
  that	
  macros	
  are	
  used	
  to	
  
simplify	
  and	
  automate	
  the	
  work.	
  We	
  will	
  make	
  use	
  of	
  a	
  macro	
  for	
  the	
  first	
  time	
  to	
  simplify	
  
using	
  the	
  ID	
  number	
  of	
  the	
  GA	
  account	
  in	
  next	
  cases	
  of	
  using	
  this	
  number	
  ID	
  on	
  our	
  
account.	
  	
  
	
  
	
  
 
	
  
	
  
26	
  
What	
  to	
  do	
  then?	
  
	
  
1. Mark	
  the	
  ID	
  number	
  and	
  copy	
  it	
  to	
  the	
  storage	
  (ctrl	
  +	
  C)	
  
2. Click	
  on	
  the	
  "brick”	
  and	
  choose	
  "New	
  macro”	
  at	
  the	
  bottom.	
  
3. Add	
  the	
  macro	
  name	
  that	
  we	
  know	
  what	
  this	
  macro	
  is	
  used	
  for,	
  choose	
  the	
  
type	
  as	
  "Constant	
  String”	
  and	
  a	
  value	
  as	
  an	
  ID	
  of	
  our	
  Google	
  Analytics	
  account.	
  There	
  
are	
  many	
  macro	
  types	
  and	
  with	
  time	
  we	
  will	
  make	
  use	
  of	
  different	
  than	
  “Constant	
  
String”.	
  Now	
  we	
  are	
  not	
  dealing	
  with	
  it.	
  
	
  
	
  
	
  
After	
  that	
  we	
  can	
  use	
  a	
  given	
  macro	
  and	
  thanks	
  to	
  this	
  we	
  do	
  not	
  need	
  to	
  remember	
  the	
  ID	
  
of	
  Google	
  Analytics	
  account	
  with	
  the	
  next	
  tags	
  which	
  are	
  to	
  be	
  installed.	
  
	
  
 
	
  
	
  
27	
  
	
  
It	
  is	
  one	
  of	
  the	
  simplest	
  methods	
  of	
  using	
  macros	
  but	
  thanks	
  to	
  this	
  we	
  will	
  not	
  make	
  
mistake	
  while	
  pasting	
  codes	
  and	
  what	
  is	
  more,	
  we	
  do	
  not	
  waste	
  the	
  time	
  for	
  checking	
  a	
  
given	
  ID	
  many	
  times.	
  I	
  will	
  emphasize	
  once	
  more	
  that	
  Analytics	
  tag	
  has	
  its	
  types,	
  which	
  are	
  
responsible	
  for	
  different	
  types	
  of	
  tracked	
  data.	
  So,	
  if	
  we	
  want	
  to	
  track	
  events	
  and	
  
ecommerce	
  transactions	
  by	
  GTM,	
  we	
  will	
  have	
  to	
  use	
  three	
  tags:	
  for	
  pageviews	
  (standard),	
  
for	
  events	
  and	
  for	
  transactions.	
  	
  We	
  need	
  to	
  give	
  the	
  ID	
  number	
  of	
  the	
  GA	
  account	
  each	
  time	
  
we	
  create	
  a	
  tag	
  for	
  given	
  GA	
  account.	
  Thanks	
  to	
  the	
  created	
  macro	
  we	
  do	
  not	
  have	
  to	
  
remember	
  ID	
  of	
  account.	
  So	
  we	
  used	
  macro	
  for	
  the	
  first	
  time.	
  It	
  is	
  simple	
  way	
  but	
  very	
  
useful	
  and	
  we	
  will	
  use	
  it,	
  in	
  this	
  way,	
  quite	
  often.	
  	
  
	
  
***OFF	
  TOPIC***	
  
	
  
Let's	
  come	
  back	
  to	
  creating	
  our	
  Tag.	
  	
  After	
  choosing	
  a	
  type	
  of	
  the	
  tag	
  as	
  Google	
  Analytics,	
  
we	
  can	
  see	
  the	
  option	
  “Enable	
  Display	
  Advertising	
  Features”	
  below.	
  This	
  option	
  is	
  used	
  for	
  
switching	
  on	
  possibilities	
  to	
  make	
  use	
  of	
  remarketing	
  in	
  Google	
  Analytics	
  and	
  demographic	
  
reports.	
  In	
  practice	
  this	
  option	
  adds	
  to	
  the	
  code	
  a	
  Doubleclick	
  cookie,	
  which	
  is	
  just	
  
responsible	
  for	
  these	
  additional	
  possibilities	
  of	
  Google	
  Analytics.	
  	
  
	
  	
  
	
  
	
  
	
  
 
	
  
	
  
28	
  
Track	
  type	
  
	
  
I	
  have	
  mentioned	
  about	
  track	
  types	
  a	
  little	
  earlier	
  by	
  the	
  way	
  of	
  creating	
  the	
  first	
  macro.	
  
There	
  can	
  be	
  many	
  track	
  types	
  depending	
  on	
  a	
  kind	
  of	
  a	
  tag.	
  Even	
  in	
  the	
  case	
  of	
  Google	
  
Analytics	
  we	
  have	
  them	
  quite	
  a	
  lot.	
  
	
  
	
  
	
  
Website	
  View	
  tracking	
  is	
  of	
  course	
  a	
  standard	
  type	
  but	
  in	
  the	
  further	
  part	
  we	
  will	
  use	
  next	
  
types,	
  just	
  as	
  we	
  will	
  want	
  to	
  start	
  the	
  following	
  functionalities	
  of	
  Google	
  Analytics	
  with	
  
GTM,	
  such	
  as,	
  for	
  example,	
  event	
  tracking	
  on	
  the	
  website	
  or	
  traffic	
  tracking	
  between	
  
domains.	
  We	
  will	
  talk	
  about	
  it	
  further	
  on.	
  
	
  	
  
The first rule in GTM
	
  
At	
  this	
  moment	
  we	
  have	
  just	
  almost	
  configured	
  the	
  first	
  tag.	
  The	
  only	
  thing	
  which	
  is	
  left	
  
before	
  testing	
  and	
  publishing	
  it	
  is	
  to	
  add	
  a	
  rule	
  which	
  will	
  allow	
  us	
  to	
  set	
  the	
  rules	
  when	
  
 
	
  
	
  
29	
  
GTM	
  has	
  to	
  fire	
  a	
  given	
  tag.	
  
	
  
Rules	
  are	
  set	
  in	
  interface	
  in	
  the	
  right	
  upper	
  corner.	
  To	
  be	
  fired	
  each	
  newly	
  created	
  tag	
  will	
  
need	
  a	
  rule.	
  It	
  will	
  not	
  work	
  without	
  the	
  rule.	
  What	
  we	
  have	
  to	
  do	
  is	
  to	
  wonder	
  now	
  when	
  a	
  
given	
  tag	
  is	
  to	
  be	
  fired.	
  Our	
  first	
  Google	
  Analytics	
  tag	
  is	
  to	
  be	
  fired	
  on	
  each	
  subpage	
  of	
  our	
  
service.	
  It	
  is	
  quite	
  obvious	
  because	
  we	
  want	
  to	
  collect	
  data	
  about	
  all	
  pageviews	
  on	
  our.	
  
Then	
  we	
  have	
  to	
  set	
  the	
  rule	
  which	
  will	
  fire	
  a	
  tag	
  on	
  each	
  website	
  of	
  the	
  service.	
  	
  
	
  
	
  
	
  
When	
  we	
  want	
  to	
  add	
  a	
  new	
  rule	
  a	
  window	
  of	
  its	
  choice	
  will	
  occur.	
  We	
  can	
  choose	
  rules	
  
that	
  already	
  exist	
  and	
  which	
  we	
  have	
  created	
  earlier	
  for	
  other	
  tags	
  from	
  the	
  list	
  or	
  create	
  a	
  
new	
  one.	
  In	
  the	
  case	
  of	
  new	
  accounts	
  and	
  containers	
  we	
  have	
  to	
  create	
  rules	
  from	
  the	
  
beginning.	
  
	
  
As	
  you	
  can	
  see,	
  a	
  rule,	
  which	
  we	
  are	
  interested	
  in,	
  is	
  already	
  available	
  in	
  standard	
  –	
  fire	
  it	
  
on	
  each	
  subpage.	
  You	
  have	
  to	
  only	
  mark	
  it,	
  and	
  it	
  is	
  ready.	
  In	
  the	
  case	
  of	
  creating	
  new	
  rules	
  
we	
  have	
  to	
  create	
  a	
  rule	
  about	
  conditions,	
  which	
  have	
  to	
  be	
  satisfied	
  so	
  that	
  a	
  given	
  tag	
  
could	
  be	
  fired.	
  We	
  will	
  deal	
  with	
  creating	
  more	
  advanced	
  rules	
  later	
  in	
  this	
  e-­‐book	
  by	
  the	
  
way	
  of	
  creating	
  a	
  tag	
  for	
  tracking	
  AdWords	
  conversion	
  where	
  we	
  will	
  describe	
  creating	
  of	
  
rules	
  more	
  extensively.	
  
	
  
 
	
  
	
  
30	
  
	
  
Testing	
  a	
  newly	
  created	
  tag	
  
	
  
We	
  have	
  created	
  the	
  first	
  Tag.	
  Before	
  we	
  publish	
  it	
  on	
  the	
  website	
  it	
  is	
  worth	
  testing	
  and	
  
seeing	
  if	
  it	
  works.	
  As	
  you	
  can	
  see	
  below,	
  our	
  version	
  of	
  the	
  tag	
  is	
  unpublished.	
  It	
  means	
  that	
  
changes	
  introduced	
  by	
  us	
  did	
  not	
  come	
  into	
  effect.	
  It	
  is	
  always	
  worth	
  paying	
  attention	
  to	
  it	
  
because	
  it	
  is	
  one	
  of	
  more	
  frequent	
  mistakes	
  which	
  are	
  made	
  by	
  not	
  only	
  beginners.	
  If	
  we	
  do	
  
not	
  publish	
  changes	
  (a	
  new	
  container	
  version)	
  we	
  will	
  not	
  see	
  them	
  live.	
  They	
  could	
  be	
  
seen	
  only	
  in	
  Preview	
  –	
  Debug.	
  	
  
	
  
	
  
	
  
However,	
  before	
  we	
  publish	
  anything	
  we	
  have	
  to	
  verify	
  it.	
  We	
  choose	
  the	
  “Preview”	
  option	
  
and	
  then	
  	
  “Debug”	
  option	
  (see	
  p.17).	
  Let’s	
  move	
  to	
  our	
  website	
  in	
  a	
  new	
  tab	
  of	
  a	
  browser	
  
and	
  refresh	
  the	
  view.	
  Thanks	
  to	
  this	
  a	
  console	
  will	
  occur	
  at	
  the	
  bottom	
  of	
  the	
  screen	
  with	
  
information	
  if	
  our	
  tag	
  is	
  fired	
  under	
  conditions	
  defined	
  by	
  rules.	
  
	
  
 
	
  
	
  
31	
  
	
  
You	
  can	
  see	
  in	
  the	
  console	
  that	
  our	
  tag	
  has	
  been	
  fired.	
  Everything	
  works.	
  Now	
  we	
  can	
  come	
  
back	
  to	
  the	
  tab	
  with	
  opened	
  Tag	
  Manager	
  and	
  publish	
  the	
  version.	
  To	
  do	
  this	
  we	
  create	
  a	
  
new	
  version	
  and	
  publish	
  it.	
  A	
  new	
  version	
  is	
  created	
  now	
  (in	
  our	
  case	
  version	
  no.	
  4).	
  
	
  
	
  
Pay	
  attention	
  to	
  a	
  yellow	
  bar	
  at	
  the	
  top	
  with	
  a	
  message	
  about	
  the	
  preview	
  on	
  our	
  website.	
  If	
  
we	
  now	
  go	
  to	
  the	
  website	
  we	
  will	
  see	
  all	
  the	
  time	
  the	
  console	
  at	
  the	
  bottom	
  of	
  our	
  website.	
  
Thus,	
  if	
  we	
  finish	
  the	
  work	
  we	
  can	
  quit	
  this	
  mode	
  (For	
  clarity,	
  a	
  preview	
  mode	
  is	
  seen	
  only	
  by	
  
 
	
  
	
  
32	
  
us,	
  other	
  users	
  cannot	
  see	
  it.	
  They	
  could	
  see	
  it	
  if	
  we	
  would	
  sent	
  them	
  a	
  special	
  link	
  to	
  the	
  
preview,	
  which	
  I	
  have	
  written	
  about	
  before).	
  	
  	
  
	
  
	
  
Next	
  steps	
  
	
  
Our	
  first	
  tag	
  has	
  been	
  published.	
  Now,	
  we	
  are	
  ready	
  to	
  install	
  next	
  tags	
  which	
  will	
  be	
  
needed	
  to	
  track	
  our	
  advertising	
  actions	
  and	
  not	
  only.	
  However,	
  before	
  we	
  move	
  to	
  the	
  next	
  
tags,	
  we	
  should	
  mention	
  about	
  a	
  very	
  useful	
  tool	
  which	
  will	
  allow	
  us	
  to	
  see	
  if	
  our	
  website,	
  
or	
  any	
  other,	
  has	
  installed	
  and	
  working	
  tags.	
  This	
  tool	
  is	
  Tag	
  Assistant.	
  It	
  is	
  a	
  simple	
  and	
  
friendly	
  plug-­‐in	
  to	
  Chrome	
  browser.	
  
	
  
	
  
	
  
	
  
Thanks	
  to	
  Tag	
  Assistant	
  we	
  can	
  easily	
  verify	
  what	
  tags	
  are	
  working	
  on	
  the	
  website	
  being	
  
viewed	
  by	
  us.	
  We	
  will	
  get	
  guidelines	
  and	
  suggestions	
  concerning	
  tag	
  implementation.	
  Tag	
  
Assistant	
  is	
  a	
  tool,	
  which	
  is,	
  we	
  can	
  say,	
  obligatory.	
  Assistant	
  can	
  be	
  downloaded	
  free	
  from	
  
Google	
  Chrome	
  shop.	
  
	
  
 
	
  
	
  
33	
  
Installation of Google AdWords conversion tracking with GTM
	
  
In	
  the	
  previous	
  chapter	
  we	
  managed	
  to	
  create	
  the	
  first	
  tag,	
  which	
  is	
  used	
  for	
  tracking	
  
displays	
  with	
  Google	
  Analytics.	
  We	
  have	
  created	
  the	
  account,	
  the	
  container,	
  then	
  the	
  tag	
  
where	
  we	
  have	
  chosen	
  its	
  type	
  (Google	
  Analytics)	
  and	
  defined	
  when	
  our	
  tag	
  has	
  to	
  be	
  fired	
  
(rule).	
  In	
  this	
  step	
  we	
  will	
  create	
  a	
  tag,	
  which	
  will	
  service	
  AdWords	
  conversion	
  tracking.	
  
	
  
	
  
AdWords	
  or	
  other	
  conversion	
  tracking	
  	
  
	
  
What	
  do	
  we	
  actually	
  need	
  for	
  conversion	
  tracking?	
  We	
  need	
  to	
  measure	
  traffic	
  on	
  the	
  
website	
  or	
  a	
  number	
  of	
  actions	
  which	
  will	
  confirm	
  that	
  the	
  conversion	
  took	
  place.	
  	
  For	
  
example,	
  a	
  classical	
  example	
  of	
  a	
  conversion	
  are	
  displays	
  of	
  the	
  website	
  “Thank	
  you	
  for”	
  –	
  
purchase,	
  contact,	
  etc.	
  That	
  is	
  the	
  website	
  which	
  is	
  displayed	
  only	
  when	
  a	
  user	
  did	
  some	
  
action	
  desirable	
  by	
  us,	
  for	
  example,	
  filling	
  in	
  the	
  form.	
  A	
  classical	
  conversion	
  path	
  seems	
  to	
  
look	
  more	
  or	
  less	
  like	
  this:	
  	
  
	
  
	
  
Main	
  website	
  -­‐>	
  category	
  website	
  -­‐>	
  product	
  website	
  -­‐>	
  form	
  -­‐>	
  payment	
  -­‐>thank	
  you.	
  
	
  
	
  
To	
  track	
  the	
  conversion	
  we	
  need	
  to	
  track	
  the	
  last	
  website	
  -­‐	
  “Thank	
  you”	
  with	
  the	
  special	
  
code	
  called	
  the	
  conversion	
  tracking	
  code.	
  During	
  visits	
  from	
  AdWords	
  ads,	
  the	
  code	
  is	
  
compared	
  to	
  a	
  cookie,	
  which	
  was	
  granted	
  to	
  users	
  at	
  the	
  moment	
  of	
  clicking	
  on	
  the	
  advert.	
  
If	
  data	
  from	
  the	
  cookie	
  matches	
  data	
  from	
  the	
  tracking	
  code,	
  a	
  conversion	
  is	
  counted.	
  
It	
  is	
  a	
  description	
  of	
  working	
  in	
  short,	
  but	
  it	
  is	
  only	
  to	
  remind	
  it	
  and	
  to	
  eliminate	
  the	
  mental	
  
shortcuts	
  of	
  the	
  author.	
  
	
  	
  
To	
  track	
  conversions	
  we	
  need	
  an	
  address	
  of	
  the	
  "Thank	
  you”	
  website	
  and	
  we	
  have	
  to	
  place	
  
a	
  suitable	
  conversion	
  code	
  on	
  this	
  website.	
  So	
  far,	
  it	
  has	
  been	
  as	
  follows:	
  
 
	
  
	
  
34	
  
	
  
1.	
  We	
  have	
  generated	
  a	
  conversion	
  code	
  in	
  AdWords	
  account	
  
2.	
  We	
  have	
  copied	
  the	
  code.	
  
3.	
  We	
  have	
  edited	
  the	
  "Thank	
  you”	
  website	
  	
  
4.	
  We	
  have	
  pasted	
  the	
  conversion	
  code	
  in	
  the	
  code	
  somewhere	
  at	
  the	
  end	
  of	
  the	
  website	
  
just	
  before	
  the	
  closing	
  </body>	
  tag.	
  
	
  
	
  
Implementation	
  of	
  the	
  conversion	
  tracking	
  code	
  with	
  GTM	
  
	
  
At	
  present,	
  thanks	
  to	
  GTM,	
  we	
  do	
  not	
  have	
  to	
  edit	
  the	
  website	
  to	
  implement	
  conversion	
  
tracking	
  code.	
  You	
  only	
  have	
  to	
  create	
  a	
  suitable	
  tag	
  in	
  GTM	
  and	
  give	
  it	
  proper	
  rules.	
  As	
  it	
  is	
  
assumed	
  the	
  code	
  is	
  to	
  be	
  fired	
  on	
  “Thank	
  you”	
  pages.	
  So	
  to	
  create	
  the	
  conversion	
  tag	
  we	
  
have	
  go	
  through	
  a	
  few	
  steps:	
  
	
  
1.	
  Create	
  a	
  conversion	
  in	
  AdWords	
  account	
  
2.	
  Create	
  a	
  conversion	
  tag	
  in	
  GTM	
  
3.	
  Give	
  a	
  rule	
  when	
  the	
  code	
  is	
  to	
  be	
  fired	
  
4.	
  Test	
  and	
  publish	
  the	
  new	
  container	
  version.	
  
	
  
	
  
	
  
Ad1.	
  Creating	
  a	
  conversion	
  in	
  AdWords	
  account	
  
	
  
To	
  start	
  tracking	
  the	
  effectiveness	
  of	
  our	
  actions	
  thanks	
  to	
  conversions,	
  first	
  we	
  have	
  to	
  
create	
  such	
  a	
  conversion	
  in	
  our	
  AdWords	
  account.	
  We	
  have	
  copied	
  the	
  whole	
  code	
  before	
  
and	
  pasted	
  it	
  onto	
  the	
  website.	
  Now	
  we	
  need	
  only	
  two	
  things	
  –	
  the	
  conversion	
  ID	
  and	
  its	
  
label.	
  To	
  do	
  this	
  we	
  need	
  to	
  preview	
  the	
  code	
  of	
  conversion	
  created	
  by	
  us	
  in	
  AdWords	
  
interface	
  (Tools	
  tab	
  -­‐>	
  Conversions	
  -­‐>	
  code).	
  
	
  
 
	
  
	
  
35	
  
	
  
	
  
Ad	
  2.	
  	
  Creating	
  a	
  conversion	
  tag	
  in	
  GTM	
  
	
  
We	
  already	
  have	
  ID	
  and	
  the	
  label	
  of	
  the	
  conversion,	
  thus,	
  we	
  can	
  move	
  to	
  create	
  a	
  
conversion	
  tag	
  and	
  start	
  to	
  track	
  a	
  conversion	
  with	
  GTM.	
  
	
  
 
	
  
	
  
36	
  
	
  
	
  
1.	
  Create	
  a	
  new	
  tag	
  in	
  our	
  container	
  
2.	
  Give	
  it	
  a	
  proper	
  name	
  
3.	
  As	
  a	
  type	
  choose	
  AdWords	
  Conversion	
  Tracking	
  
4.	
  Add	
  copied	
  ID	
  and	
  label	
  from	
  the	
  conversion	
  code	
  generated	
  before	
  (a	
  conversion	
  
value	
  is	
  non-­‐obligatory	
  and	
  we	
  do	
  not	
  have	
  to	
  give	
  it).	
  
5.	
  Add	
  a	
  rule	
  when	
  the	
  code	
  is	
  to	
  be	
  fired.	
  
	
  
	
  
Everything	
  is	
  clear	
  to	
  the	
  step	
  no.	
  4	
  but	
  in	
  the	
  step	
  no.	
  5	
  we	
  have	
  to	
  stop	
  for	
  a	
  while	
  to	
  say	
  
something	
  more	
  about	
  rules.	
  Remember	
  that	
  we	
  have	
  to	
  track	
  the	
  conversion	
  on	
  the	
  
website	
  of	
  “Thank	
  you”	
  type.	
  In	
  our	
  case	
  the	
  website	
  of	
  this	
  type	
  is	
  the	
  website	
  after	
  filling	
  
in	
  the	
  form	
  whose	
  address	
  is	
  www.test_website.com/thankyou.html.	
  
We	
  want	
  a	
  conversion	
  code	
  to	
  be	
  displayed	
  only	
  on	
  this	
  website.	
  We	
  do	
  not	
  want	
  this	
  code	
  
to	
  be	
  active	
  on	
  any	
  other	
  website.	
  Therefore,	
  we	
  create	
  the	
  rule,	
  which	
  will	
  guarantee	
  this	
  
to	
  us.	
  
	
  
We	
  choose	
  "Add	
  the	
  rule”	
  and	
  then	
  "Create	
  a	
  new	
  rule”.	
  As	
  you	
  can	
  see	
  in	
  the	
  image	
  below,	
  
rules	
  are	
  created	
  from	
  two	
  parts:	
  variable	
  (macros)	
  and	
  value.	
  In	
  this	
  case	
  we	
  choose	
  
Conversion	
  value	
  (optional)	
  
 
	
  
	
  
37	
  
{{url}}	
  macro	
  which	
  is	
  responsible	
  for	
  considering	
  URL	
  addresses	
  and	
  values	
  of	
  this	
  
variable	
  that	
  is	
  the	
  address	
  of	
  our	
  website	
  –	
  thankyou.html.	
  Between	
  these	
  parts	
  we	
  choose	
  
a	
  logical	
  parameter,	
  which	
  will	
  be	
  a	
  principle	
  of	
  their	
  combination.	
  
.	
  	
  
	
  
In	
  our	
  case	
  the	
  whole	
  condition	
  (rule)	
  says	
  as	
  follows:	
  If	
  the	
  URL	
  address	
  includes	
  the	
  
"thankyou.html"	
  string	
  of	
  characters,	
  fire	
  the	
  conversion	
  tracking	
  tag.	
  
	
  
	
  
Of	
  course	
  we	
  can	
  choose	
  other	
  logical	
  conditions	
  such	
  as	
  "equals”,	
  "does	
  not	
  equal”,	
  "ends”,	
  
etc.	
  
	
  
 
	
  
	
  
38	
  
Actually	
  we	
  could	
  stop	
  here	
  because	
  we	
  have	
  done	
  everything	
  correctly.	
  Now	
  we	
  have	
  to	
  
test	
  (Debug,	
  Preview)	
  possibly	
  if	
  everything	
  works	
  properly,	
  create	
  a	
  new	
  version	
  and	
  
publish	
  it.	
  Voila,	
  another	
  tag	
  on	
  our	
  website	
  has	
  been	
  installed.	
  
	
  
However,	
  there	
  is	
  one	
  detail	
  yet	
  which	
  was	
  not	
  explained	
  here	
  fully.	
  Macros.	
  
Indeed,	
  we	
  have	
  used	
  {{url}}	
  macro.	
  The	
  question	
  is,	
  where	
  is	
  it	
  from	
  and	
  what	
  is	
  it	
  about?	
  I	
  
will	
  try	
  to	
  explain	
  the	
  subject	
  of	
  macros	
  here	
  but	
  their	
  use	
  will	
  be	
  used	
  in	
  most	
  of	
  our	
  
actions	
  in	
  GTM	
  so	
  the	
  subject	
  of	
  macros	
  will	
  be	
  present	
  almost	
  in	
  every	
  example.	
  	
  
The first contact with macros in Google Tag Manager
	
  
As	
  I	
  have	
  mentioned	
  at	
  a	
  very	
  beginning,	
  macros	
  are	
  used	
  for	
  automating	
  and	
  simplifying	
  
work	
  with	
  data	
  in	
  GTM.	
  It	
  is	
  quite	
  a	
  general	
  description	
  but	
  it	
  is	
  enough	
  for	
  the	
  beginning.	
  
Macros	
  are,	
  in	
  fact,	
  links	
  between	
  data	
  on	
  the	
  website	
  and	
  our	
  tags,	
  macros	
  may	
  convey	
  
values	
  between	
  a	
  website	
  and	
  individual	
  tags,	
  macros	
  may	
  also	
  be	
  a	
  basis	
  for	
  building	
  
conditions	
  of	
  firing	
  tags	
  (in	
  this	
  way	
  we	
  have	
  used	
  {{url}}	
  macro).	
  In	
  the	
  previous	
  chapter	
  
we	
  have	
  created	
  also	
  the	
  first	
  macro	
  where	
  the	
  value	
  was	
  the	
  ID	
  number	
  of	
  our	
  Analytics	
  
account.	
  
If	
  we	
  want	
  to	
  create	
  the	
  rule	
  in	
  which	
  there	
  are	
  variable	
  values	
  depending	
  on	
  a	
  situation,	
  
we	
  will	
  use	
  the	
  macro	
  then.	
  	
  Like	
  URL	
  addresses	
  have	
  a	
  lot	
  of	
  variables	
  and	
  all	
  are	
  taken	
  
into	
  consideration,	
  we,	
  in	
  our	
  example,	
  have	
  placed	
  the	
  value	
  “thankyou.html.”	
  for	
  our	
  
{{url}}	
  macro.	
  	
  
	
  
	
  
This	
  all	
  constitutes	
  an	
  opinion	
  that	
  macros	
  are	
  one	
  of	
  the	
  most	
  essential	
  elements,	
  which	
  
we	
  have	
  to	
  deal	
  with	
  in	
  GTM.	
  I	
  think	
  that	
  even	
  if	
  a	
  macro	
  is	
  something	
  abstract	
  at	
  this	
  
moment,	
  it	
  will	
  not	
  be	
  when	
  we	
  will	
  consider	
  many	
  examples.	
  	
  
	
  
 
	
  
	
  
39	
  
Below,	
  there	
  is	
  a	
  list	
  of	
  all	
  macros,	
  which	
  are	
  currently	
  on	
  my	
  account.	
  A	
  part	
  of	
  them	
  is	
  
standard	
  and	
  present	
  from	
  the	
  beginning	
  on	
  the	
  account,	
  the	
  rest	
  need	
  to	
  be	
  created.	
  So	
  far	
  
we	
  have	
  created	
  one	
  macro	
  concerning	
  ID	
  of	
  Analytics	
  account	
  to	
  make	
  the	
  work	
  easier,	
  we	
  
have	
  used	
  one	
  ready	
  {{url}}	
  macro	
  to	
  define	
  the	
  rule.	
  Now	
  there	
  is	
  a	
  turn	
  to	
  explain	
  more	
  
about	
  macros.	
  
	
  
	
  
	
  
What does the macro consist of and how is it created?
	
  
As	
  you	
  can	
  see,	
  the	
  macro	
  always	
  consists	
  of	
  two	
  braces	
  and	
  a	
  name,	
  e.g.	
  {{url}}.	
  
In	
  this	
  way	
  we	
  always	
  use	
  macros	
  within	
  GTM.	
  
	
  
Each	
  macro	
  has	
  its	
  type.	
  It	
  can	
  be	
  a	
  macro,	
  which	
  will	
  be	
  used	
  for	
  defining	
  url	
  addresses,	
  
but	
  there	
  are	
  several	
  types	
  of	
  macros.	
  For	
  example,	
  the	
  macro,	
  which	
  we	
  have	
  created	
  at	
  
the	
  beginning	
  for	
  the	
  need	
  of	
  ID	
  account,	
  was	
  simply	
  a	
  string	
  of	
  characters	
  “Constant	
  
string”.	
  
	
  
 
	
  
	
  
40	
  
	
  
	
  
As	
  you	
  can	
  see	
  in	
  the	
  image	
  above	
  there	
  are	
  quite	
  a	
  lot	
  of	
  macros.	
  So	
  far	
  we	
  have	
  used	
  two	
  
macros	
  but	
  we	
  need	
  to	
  use	
  a	
  greater	
  number	
  of	
  them.	
  
	
  
We	
  will	
  create	
  macros	
  up	
  to	
  date,	
  if	
  we	
  need	
  to	
  combine	
  data	
  from	
  the	
  website	
  with	
  our	
  
tags.	
  Depending	
  on	
  what	
  a	
  given	
  macro	
  will	
  have	
  to	
  provide,	
  we	
  will	
  use	
  such	
  a	
  macro.	
  
	
  
I	
  think	
  that	
  we	
  can	
  now	
  put	
  the	
  subject	
  of	
  macros	
  aside.	
  In	
  the	
  next	
  examples	
  we	
  will	
  come	
  
back	
  to	
  it	
  many	
  times	
  yet	
  and	
  explain	
  their	
  work	
  
Implementation of Google AdWords remarketing with GTM
	
  
So	
  far	
  we	
  have	
  placed	
  two	
  very	
  important	
  tags	
  on	
  our	
  website	
  –	
  Google	
  Analytics	
  and	
  the	
  
tracking	
  code	
  of	
  AdWords	
  conversion.	
  Another	
  important	
  and	
  what	
  is	
  more,	
  basic	
  code,	
  
which	
  is	
  commonly	
  displayed	
  on	
  pages,	
  is	
  a	
  remarketing	
  code.	
  	
  
	
  
In	
  this	
  e-­‐book	
  I	
  will	
  not	
  explain	
  what	
  remarketing	
  is	
  because	
  this	
  subject	
  is	
  not	
  the	
  subject	
  
of	
  this	
  publication.	
  We	
  can	
  say	
  only	
  that	
  the	
  remarketing	
  code	
  is	
  a	
  code	
  which	
  is	
  used	
  for	
  
 
	
  
	
  
41	
  
bringing	
  back	
  users	
  on	
  the	
  website	
  with	
  the	
  help	
  of	
  adverts,	
  users	
  who	
  did	
  or	
  did	
  not	
  do	
  
any	
  action	
  on	
  our	
  website	
  e.g.	
  did	
  not	
  buy	
  any	
  product	
  and	
  left	
  our	
  service.	
  It	
  is	
  a	
  classical	
  
example	
  but	
  there	
  are	
  lots	
  of	
  applications	
  of	
  remarketing.	
  We	
  will	
  focus	
  here	
  on	
  a	
  technical	
  
side	
  that	
  is	
  on	
  implementation	
  of	
  the	
  remarketing	
  code	
  on	
  particular	
  pages	
  of	
  our	
  service.	
  
	
  
	
  
Creating	
  a	
  remarketing	
  tag	
  
As	
  in	
  the	
  previous	
  chapters,	
  we	
  create	
  a	
  new	
  tag	
  in	
  GTM	
  and	
  choose	
  its	
  kind	
  as	
  
remarketing.	
  We	
  also	
  have	
  to	
  obtain	
  ID	
  of	
  the	
  remarketing	
  code.	
  
To	
  do	
  this	
  we	
  have	
  to	
  visit	
  our	
  AdWords	
  account	
  and	
  a	
  “Shared	
  library”	
  tab	
  then	
  
“Audiences”.	
  	
  There	
  are,	
  or	
  there	
  will	
  be,	
  our	
  remarketing	
  lists.	
  
	
  
Let’s	
  move	
  to	
  an	
  option	
  of	
  displaying	
  the	
  details	
  of	
  the	
  remarketing	
  tag	
  and	
  from	
  there	
  we	
  
have	
  to	
  obtain	
  the	
  ID	
  number	
  of	
  our	
  tag,	
  which	
  will	
  be	
  displayed	
  in	
  a	
  moment	
  in	
  GTM.	
  
	
  
	
  
	
  	
  
	
  	
  
 
	
  
	
  
42	
  
We	
  come	
  back	
  to	
  Tag	
  Manager	
  and	
  place	
  ID	
  in	
  a	
  suitable	
  place.	
  Only	
  ID	
  is	
  necessary,	
  we	
  do	
  
not	
  have	
  to	
  give	
  labels,	
  which	
  were	
  deleted	
  in	
  common	
  remarketing	
  code.	
  Only	
  if	
  we	
  create	
  
new	
  codes	
  in	
  one	
  account,	
  there	
  will	
  be	
  need	
  of	
  distinguish	
  them	
  with	
  labels.	
  	
  	
  
Labels	
  are	
  used	
  for	
  a	
  unique	
  labeling	
  conversion	
  codes	
  on	
  the	
  account.	
  Now	
  we	
  can	
  use	
  one	
  
code	
  and	
  we	
  create	
  remarketing	
  lists	
  on	
  the	
  basis	
  of	
  this	
  code	
  and	
  rules	
  defining	
  when	
  the	
  
list	
  is	
  to	
  collect	
  cookies.	
  That	
  can	
  be	
  done	
  directly	
  from	
  AdWords	
  account.	
  
	
  
	
  
	
  
	
  
Now	
  we	
  have	
  to	
  only	
  create	
  a	
  rule	
  when	
  a	
  given	
  remarketing	
  code	
  will	
  be	
  called	
  to	
  collect	
  
cookies	
  (i.e.	
  website	
  visitors).	
  We	
  almost	
  always	
  start	
  adventure	
  with	
  remarketing	
  from	
  
building	
  the	
  list	
  of	
  cookies	
  of	
  everyone	
  who	
  visited	
  our	
  website.	
  Hence,	
  in	
  this	
  example	
  we	
  
will	
  use	
  the	
  same	
  rule	
  like	
  in	
  the	
  case	
  of	
  Google	
  Analytics	
  (all	
  pages).	
  A	
  code	
  is	
  to	
  be	
  called	
  
on	
  every	
  website	
  of	
  our	
  service.	
  That	
  means	
  that	
  the	
  remarketing	
  cookie	
  will	
  be	
  given	
  to	
  
each	
  browser1,	
  who	
  will	
  visit	
  our	
  service,	
  no	
  matter	
  what	
  subpage	
  of	
  the	
  service	
  it	
  meets.	
  
	
  
	
  
	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
1
Writing about users or people we have to consider that it is a mental shortcut because we really think
 
	
  
	
  
43	
  
	
  
	
  
A	
  remarketing	
  code	
  can	
  be	
  fired	
  also	
  with	
  the	
  help	
  of	
  other	
  rules.	
  We	
  could,	
  for	
  example,	
  
create	
  a	
  rule,	
  which	
  will	
  fire	
  the	
  remarketing	
  tag,	
  if	
  somebody	
  clicks	
  on	
  the	
  link	
  or	
  a	
  button.	
  
We	
  can	
  create	
  rules,	
  which	
  will	
  fire	
  the	
  list	
  after	
  the	
  time	
  chosen	
  by	
  many	
  others	
  and	
  us.	
  
While	
  reading	
  this	
  e-­‐book	
  we	
  will	
  get	
  to	
  know	
  how	
  to	
  create	
  such	
  rules.	
  	
  
	
  
While	
  we	
  now	
  fire	
  the	
  tag	
  on	
  every	
  website	
  of	
  our	
  website	
  we	
  can	
  then	
  create	
  remarketing	
  
lists	
  directly	
  on	
  our	
  AdWords	
  account	
  based	
  on	
  fired	
  remarketing	
  tag	
  and	
  rules	
  set	
  on	
  
AdWords	
  accounts	
  while	
  creating	
  new	
  remarketing	
  lists.	
  	
  
	
  
In	
  the	
  image	
  from	
  the	
  previous	
  website,	
  we	
  can	
  see	
  also	
  something	
  which	
  is	
  marked	
  as	
  
"Customs	
  parameters”.	
  These	
  parameters	
  are	
  used	
  for	
  creating	
  more	
  advanced	
  conditions	
  
of	
  firing	
  tags.	
  We	
  can,	
  for	
  example,	
  download	
  data	
  from	
  the	
  website	
  about	
  values	
  of	
  a	
  
customer’s	
  basket	
  and	
  depending	
  on	
  its	
  value	
  fire	
  the	
  remarketing	
  tag	
  or	
  (add	
  to	
  the	
  list	
  or	
  
not).	
  We	
  use	
  these	
  parameters	
  in	
  creating	
  a	
  campaign	
  of	
  dynamic	
  remarketing.	
  In	
  this	
  place	
  
our	
  adventure	
  with	
  something,	
  which	
  is	
  called	
  Data	
  Layer,	
  starts.	
  
	
  
Data	
  Layer	
  is	
  probably	
  the	
  most	
  important	
  functionality	
  of	
  Google	
  Tag	
  Manager	
  because	
  it	
  
makes	
  data	
  on	
  the	
  website	
  dependent	
  on	
  the	
  website	
  code	
  itself	
  and	
  makes	
  that	
  data	
  from	
  
the	
  website	
  become	
  available	
  for	
  many	
  our	
  tools	
  which	
  we	
  have	
  on	
  the	
  website.	
  We	
  can	
  
compare	
  Data	
  Layer	
  to	
  a	
  universal	
  plug-­‐in,	
  which	
  we	
  can	
  buy	
  at	
  the	
  airport,	
  to	
  which	
  from	
  
one	
  side	
  we	
  can	
  connect	
  a	
  laptop	
  and	
  from	
  the	
  other	
  we	
  can	
  plug	
  any	
  socket	
  all	
  over	
  the	
  
 
	
  
	
  
44	
  
world.	
  	
  
In	
  the	
  same	
  way	
  data	
  from	
  our	
  website,	
  thanks	
  to	
  such	
  a	
  universal	
  plugin,	
  can	
  be	
  
comprehensible	
  for	
  many	
  tools	
  and	
  there	
  is	
  no	
  need	
  to	
  connect	
  them	
  separately	
  to	
  the	
  
website.	
  We	
  will	
  talk	
  about	
  Data	
  Layer	
  in	
  details	
  later	
  in	
  this	
  e-­‐book,	
  so	
  do	
  not	
  worry	
  that	
  
now	
  it	
  can	
  be	
  a	
  little	
  unclear.	
  
	
  
Important!	
  At	
  this	
  moment	
  we	
  can	
  create	
  remarketing	
  lists	
  within	
  Google	
  Analytics,	
  which	
  I	
  
encourage	
  to.	
  Thanks	
  to	
  GA	
  we	
  can	
  create	
  lists	
  based	
  on	
  many	
  actions	
  of	
  users	
  of	
  our	
  
website.	
  We	
  do	
  not	
  have	
  to	
  use	
  an	
  AdWords	
  remarketing	
  code	
  then.	
  We	
  create	
  remarketing	
  
lists	
  in	
  the	
  Analytics	
  interface	
  itself.	
  (Until	
  now	
  remarketing	
  is	
  not	
  serviced	
  by	
  Universal	
  
Analytics).	
  
	
  
	
  
	
  
 
	
  
	
  
45	
  
Google Tag Manager – advanced cases of use
	
  
On	
  previous	
  pages	
  we	
  have	
  discussed	
  the	
  most	
  frequent	
  and	
  basic	
  methods	
  of	
  using	
  GTM	
  in	
  
work	
  with	
  tags	
  on	
  our	
  website.	
  We	
  have	
  installed	
  a	
  basic	
  Google	
  Analytics	
  code,	
  AdWords	
  
conversion	
  tracking	
  and	
  a	
  remarketing	
  code.	
  Most	
  installations	
  end	
  here.	
  However,	
  times	
  
are	
  different	
  now,	
  so	
  we	
  need	
  more	
  and	
  more	
  data	
  to	
  collect	
  and	
  process	
  from	
  our	
  website,	
  
we	
  need	
  to	
  understand	
  more	
  and	
  more	
  precisely	
  what	
  visitors	
  of	
  our	
  website	
  really	
  need,	
  
we	
  need	
  to	
  better	
  aim	
  our	
  marketing	
  campaigns,	
  etc.	
  That	
  is	
  why,	
  surely,	
  there	
  is	
  a	
  need	
  of	
  
additional	
  operations	
  on	
  data	
  which	
  are	
  on	
  our	
  website,	
  we	
  will	
  want	
  to	
  examine	
  every	
  
area	
  of	
  the	
  website,	
  we	
  will	
  want	
  to	
  mark	
  every	
  visitor	
  in	
  a	
  better	
  way.	
  	
  
	
  
	
  
So,	
  there	
  will	
  be	
  some	
  play	
  at	
  more	
  advanced	
  implementation	
  and	
  use	
  of	
  GTM	
  possibilities.	
  
In	
  this	
  part	
  there	
  are	
  the	
  most	
  useful	
  and	
  popular	
  advanced	
  configurations	
  of	
  tags	
  and	
  
macros,	
  so	
  that	
  we	
  could	
  measure	
  everything	
  on	
  the	
  website	
  and	
  run	
  effective	
  marketing	
  
campaigns.	
  The	
  examples	
  below	
  will	
  help	
  us	
  understand	
  better	
  the	
  work	
  of	
  Google	
  Tag	
  
Manager	
  tool.	
  	
  	
  It	
  will	
  allow	
  us	
  to	
  move	
  easily	
  in	
  it	
  and	
  configure	
  any	
  tags.	
  
	
  
Data Layer – what is it and what is it used for?
	
  
Before	
  we	
  move	
  to	
  advanced	
  implementations,	
  which	
  I	
  will	
  try	
  to	
  describe	
  step	
  by	
  step,	
  it	
  is	
  
important	
  for	
  us	
  to	
  understand	
  one	
  of	
  the	
  most	
  important	
  functionality	
  of	
  GTM	
  that	
  is	
  Data	
  
Layer.	
  
What is Data Layer?
	
  
Data	
  Layer	
  is	
  a	
  combination	
  of	
  structured	
  API	
  Data	
  and	
  interfaces,	
  which	
  allow	
  making	
  use	
  
of	
  a	
  universal	
  format	
  (JSON)	
  of	
  tagging	
  services	
  and	
  sending	
  data	
  to	
  the	
  management	
  
system	
  (GTM).	
  In	
  this	
  way,	
  data	
  are	
  available	
  for	
  many	
  tools	
  with	
  no	
  need	
  to	
  tag	
  the	
  
website	
  each	
  time	
  by	
  separate	
  formats	
  for	
  every	
  tool	
  which	
  we	
  want	
  to	
  connect.	
  Not	
  clear?	
  
 
	
  
	
  
46	
  
Neither	
  to	
  me;)	
  So	
  in	
  simpler	
  words.	
  
	
  
Having	
  many	
  marketing	
  systems	
  to	
  connect	
  to	
  our	
  website	
  we	
  have	
  to	
  add	
  for	
  each	
  time	
  a	
  
special	
  code	
  (plugin)	
  for	
  every	
  tool	
  separately.	
  Each	
  tool	
  usually	
  works	
  in	
  a	
  different	
  way.	
  
	
  
If	
  we	
  have	
  many	
  things	
  to	
  measure	
  (buttons,	
  purchase	
  systems,	
  basket,	
  etc.)	
  and	
  a	
  lot	
  of	
  
tools,	
  there	
  can	
  be	
  quite	
  a	
  big	
  mess	
  on	
  our	
  website.	
  An	
  employee,	
  who	
  dealt	
  with	
  it,	
  	
  quits	
  
his	
  job	
  and	
  we	
  want	
  to	
  change	
  something	
  and	
  we	
  have	
  a	
  big	
  problem.	
  A	
  remedy	
  for	
  such	
  a	
  
situation	
  is	
  just	
  Data	
  Layer	
  which	
  has	
  been	
  compared	
  before	
  to	
  the	
  universal	
  plugin	
  which	
  
we	
  can	
  apply	
  in	
  every	
  country.	
  
	
  
	
  
	
  
 
	
  
	
  
47	
  
Data	
  Layer	
  is	
  a	
  kind	
  of	
  "translator”	
  like	
  English	
  for	
  different	
  kind	
  of	
  tools,	
  as	
  far	
  as	
  data	
  on	
  
our	
  website	
  are	
  concerned.	
  Everyone	
  loves	
  their	
  mother	
  tongue	
  but	
  not	
  everywhere	
  in	
  the	
  
world	
  we	
  can	
  communicate	
  in	
  it	
  and	
  we	
  need	
  a	
  universal	
  language.	
  In	
  our	
  world,	
  if	
  we	
  want	
  
or	
  not,	
  it	
  is	
  English.	
  In	
  the	
  world	
  of	
  data	
  it	
  is	
  Data	
  Layer.	
  
	
  
Thanks	
  to	
  this	
  information	
  from	
  the	
  website	
  such	
  as	
  events	
  (e.g.	
  button	
  clicks)	
  or	
  values	
  
can	
  be	
  sent	
  to	
  Google	
  Tag	
  Manager	
  just	
  by	
  Data	
  Layer.	
  After	
  that	
  in	
  the	
  GTM	
  tool	
  itself	
  we	
  
create	
  rules	
  on	
  the	
  basis	
  of	
  these	
  values.	
  For	
  example	
  “Call	
  a	
  remarketing	
  code	
  (tag)	
  when	
  
the	
  value	
  of	
  a	
  basket	
  is	
  higher	
  than	
  300	
  USD	
  (variable=basket,	
  value=300).	
  Rules	
  can	
  be	
  in	
  
this	
  case	
  created	
  for	
  each	
  tool	
  which	
  is	
  connected	
  on	
  our	
  website.	
  That	
  is	
  the	
  secret	
  of	
  Data	
  
Layer.	
  
	
  
Data	
  Layer	
  fulfills	
  also	
  other	
  roles.	
  It	
  allows	
  to	
  separate	
  data	
  from	
  the	
  layer	
  of	
  the	
  website	
  
code	
  (html,	
  css).	
  As	
  we	
  separated	
  the	
  style	
  layer	
  before	
  (how	
  the	
  website	
  looks	
  like)	
  thanks	
  
to	
  CSS	
  language,	
  now	
  we	
  separate	
  data	
  from	
  the	
  layer	
  of	
  the	
  website	
  code	
  itself.	
  While	
  
modifying	
  something	
  on	
  any	
  layer	
  we	
  do	
  not	
  violate	
  the	
  structure	
  of	
  the	
  rest.	
  It	
  gives	
  
security	
  and	
  order	
  in	
  administering	
  of	
  our	
  services.	
  
	
  
	
  
 
	
  
	
  
48	
  
How	
  does	
  Data	
  Layer	
  look	
  like?	
  
	
  
Data	
  Layer	
  is	
  built	
  into	
  the	
  container	
  code,	
  if	
  we	
  want	
  to	
  send	
  information	
  from	
  the	
  website	
  
(e.g.	
  events	
  like	
  clicks)	
  you	
  have	
  to	
  only	
  send	
  them	
  to	
  Data	
  Layer	
  with	
  the	
  help	
  of	
  push	
  
method.	
  For	
  example,	
  if	
  we	
  want	
  to	
  send	
  information	
  to	
  Data	
  Layer	
  that	
  somebody	
  has	
  
clicked	
  the	
  button	
  we	
  place	
  the	
  following	
  code	
  fragment	
  in	
  the	
  website	
  code:	
  
	
  
<a	
  href="#"	
  onclick="dataLayer.push({'event':	
  'sample-­‐link'});">Sample	
  link</a>	
  
	
  
If	
  someone	
  has	
  something	
  in	
  common	
  with	
  Javascript	
  language	
  they	
  know	
  that	
  the	
  push	
  
method	
  simply	
  adds	
  data	
  to	
  the	
  array.	
  And	
  this	
  just	
  happens.	
  For	
  those	
  who	
  are	
  not	
  familiar	
  
with	
  issues	
  of	
  programming,	
  information	
  that	
  method	
  works	
  the	
  same	
  like	
  in	
  the	
  case	
  of	
  
labeling	
  events	
  in	
  Google	
  Analytics	
  is	
  enough.	
  
	
  
In	
  this	
  example,	
  at	
  the	
  onclick	
  moment	
  the	
  information	
  to	
  Data	
  Layer	
  that	
  the	
  event	
  
happened	
  with	
  the	
  value	
  ‘sample-­‐link’	
  is	
  sent.	
  	
  
	
  	
  
In	
  this	
  way	
  this	
  information	
  can	
  be	
  used	
  by	
  any	
  tag	
  which	
  is	
  installed	
  on	
  the	
  website	
  by	
  
GTM.	
  For	
  example,	
  we	
  can	
  “order”	
  Google	
  Analytics	
  to	
  register	
  onclick	
  events,	
  we	
  can	
  
“order”	
  remarketing	
  tag	
  to	
  mark	
  the	
  user	
  who	
  has	
  clicked	
  on	
  the	
  link	
  (to	
  add	
  them	
  to	
  the	
  
list	
  of	
  users	
  who	
  have	
  clicked	
  on	
  the	
  link)	
  or	
  we	
  can	
  register	
  the	
  conversion	
  in	
  AdWords	
  
with	
  the	
  help	
  of	
  tag	
  of	
  AdWords	
  conversion	
  tracking.	
  
	
  
One	
  event	
  label	
  which	
  was	
  sent	
  to	
  Data	
  Layer	
  and	
  many	
  possibilities	
  of	
  being	
  used	
  by	
  many	
  
tools.	
  This	
  is	
  the	
  power	
  of	
  Data	
  Layer.	
  
	
  
 
	
  
	
  
49	
  
Adding variables and values to Data Layer
	
  
In	
  the	
  previous	
  paragraph	
  we	
  have	
  added	
  one	
  variable	
  (event)	
  and	
  one	
  value	
  (sample-­‐link)	
  
to	
  Data	
  Layer2
	
  .	
  Such	
  adding	
  data	
  to	
  Data	
  Layer	
  will	
  take	
  place	
  only	
  just	
  when	
  the	
  website	
  is	
  
loaded	
  and	
  the	
  user	
  clicks	
  on	
  the	
  marked	
  link.	
  	
  
	
  
However,	
  we	
  can	
  send	
  data	
  earlier	
  during	
  loading	
  the	
  website.	
  In	
  this	
  way	
  tags	
  which	
  will	
  
be	
  loading,	
  while	
  loading	
  the	
  website,	
  will	
  be	
  able	
  to	
  use	
  data	
  sent	
  to	
  Data	
  Layer.	
  We	
  have	
  
to	
  send	
  such	
  data	
  at	
  the	
  moment	
  of	
  downloading	
  the	
  website.	
  We	
  do	
  this	
  by	
  a	
  simple	
  array	
  
(again	
  the	
  element	
  very	
  well-­‐known	
  to	
  people	
  who	
  know	
  Javascript).	
  The	
  empty	
  table	
  looks	
  
like	
  this:	
  
	
  
	
  
	
  
	
  
The	
  essential	
  fact	
  is	
  that	
  the	
  array	
  of	
  Data	
  Layer	
  is	
  above	
  the	
  container	
  script.	
  It	
  is	
  very	
  
important.	
  Now	
  we	
  will	
  add	
  pairs	
  of	
  information	
  (variable	
  and	
  value)	
  inside	
  this	
  array.	
  We	
  
will	
  explain	
  how	
  it	
  looks	
  like	
  in	
  a	
  moment.	
  
	
  
A	
  good	
  example	
  is	
  information	
  if	
  the	
  user	
  who	
  has	
  entered	
  the	
  website	
  is	
  logged	
  in	
  or	
  not.	
  
If,	
  for	
  example,	
  the	
  user	
  is	
  not	
  logged	
  in	
  we	
  add	
  him	
  to	
  the	
  remarketing	
  list	
  of	
  people	
  who	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
2	
  Of	
  course	
  we	
  can	
  send	
  such	
  pairs	
  variable	
  :	
  value	
  as	
  many	
  as	
  we	
  want	
  for	
  one	
  event.	
  More	
  in	
  Google	
  Tag	
  
Manager	
  help.	
  	
  
 
	
  
	
  
50	
  
have	
  not	
  been	
  registered	
  yet.	
  If	
  we	
  have	
  such	
  a	
  case,	
  it	
  is	
  important	
  so	
  that	
  data	
  get	
  to	
  GTM	
  
as	
  soon	
  as	
  possible.	
  
	
  
In	
  this	
  situation	
  we	
  have	
  to	
  send	
  information	
  while	
  loading	
  an	
  individual	
  subpage.	
  That	
  is	
  
why	
  we	
  send	
  information	
  about	
  the	
  kind	
  of	
  user	
  to	
  Data	
  Layer.	
  
	
  
	
  
	
  
In	
  this	
  example	
  we	
  added	
  two	
  pieces	
  of	
  information.	
  
variable:	
  “visitor-­‐type”	
  of	
  value	
  –	
  “unregistered”	
  and	
  variable:	
  “category”	
  of	
  value	
  –	
  
“signup”.	
  
	
  
Except	
  information	
  about	
  the	
  kind	
  of	
  a	
  user,	
  we	
  have	
  send	
  at	
  once	
  information	
  about	
  the	
  
kind	
  of	
  the	
  subpage	
  (category)	
  which	
  the	
  user	
  is	
  on.	
  The	
  unregistered	
  user	
  found	
  himself	
  
on	
  the	
  “signup”	
  subpage.	
  The	
  website	
  category	
  may	
  be	
  helpful	
  e.g.	
  in	
  a	
  dynamic	
  
remarketing.	
  
	
  
Thanks	
  to	
  the	
  fact	
  that	
  data	
  were	
  immediately	
  in	
  Data	
  Layer,	
  tags	
  which	
  are	
  loaded	
  on	
  the	
  
website	
  can	
  make	
  use	
  of	
  these	
  data	
  at	
  once	
  with	
  no	
  need	
  of	
  any	
  visitor's	
  action	
  on	
  the	
  
website.	
  	
  
	
  
We	
  can	
  send	
  any	
  amount	
  of	
  data	
  to	
  Data	
  Layer.	
  There	
  is	
  one	
  question	
  which	
  can	
  occur	
  -­‐	
  
 
	
  
	
  
51	
  
Where	
  are	
  these	
  data	
  to	
  get	
  from?	
  Unfortunately,	
  in	
  this	
  particular	
  situation,	
  our	
  website	
  
will	
  often	
  require	
  interventions	
  of	
  somebody	
  who	
  will	
  be	
  able	
  to	
  send	
  data	
  
programmatically	
  to	
  Data	
  Layer	
  e.g.	
  from	
  our	
  shop	
  or	
  registration	
  system	
  (data	
  from	
  a	
  data	
  
base,	
  server).	
  If	
  somebody	
  has	
  used	
  the	
  ecommerce	
  Google	
  Analytics	
  module	
  on	
  their	
  
website,	
  the	
  matter	
  of	
  sending	
  variable	
  values	
  to	
  Data	
  Layer	
  is	
  analogical.	
  Simply	
  speaking	
  
(not	
  programmatically):	
  in	
  Data	
  Layer	
  there	
  must	
  be	
  values	
  from	
  our	
  shop,	
  from	
  a	
  sales	
  
module,	
  etc,	
  which	
  will	
  be	
  recorded	
  clearly	
  for	
  GTM	
  (read:	
  variable	
  –	
  value).	
  It	
  can	
  be	
  e.g.	
  a	
  
basket	
  value	
  which	
  will	
  be	
  sent	
  to	
  Data	
  Layer	
  from	
  our	
  shop,	
  thanks	
  to	
  which	
  GTM	
  (and	
  
other	
  tags	
  installed	
  there)	
  will	
  be	
  able	
  to	
  use	
  this	
  value	
  e.g.	
  to	
  create	
  conditions	
  of	
  firing	
  
tags.	
  
	
  
NOTICE:	
  Data	
  Layer	
  is	
  not	
  required	
  in	
  any	
  way.	
  Without	
  Data	
  Layer,	
  GTM	
  will	
  also	
  fulfill	
  its	
  
role	
  of	
  “tag	
  storage	
  and	
  management”.	
  However,	
  lack	
  of	
  Data	
  Layer	
  limits	
  a	
  lot	
  possibilities	
  
which	
  GTM	
  gives	
  to	
  us.	
  
	
  
After	
  this	
  short	
  comment	
  about	
  what	
  Data	
  Layer	
  consists	
  in	
  we	
  can	
  go	
  to	
  more	
  advanced	
  
examples	
  of	
  using	
  GTM	
  in	
  work	
  with	
  measuring	
  our	
  activity	
  in	
  the	
  Internet.	
  
	
  
If	
  we	
  want	
  to	
  see	
  what	
  was	
  loaded	
  to	
  Data	
  Layer	
  we	
  can	
  easily	
  check	
  it	
  with	
  the	
  help	
  of	
  the	
  
console	
  for	
  programmers	
  for	
  example	
  in	
  Chrome	
  browser.	
  We	
  enter	
  the	
  menu	
  View	
  -­‐>	
  
Developer	
  -­‐>	
  Javascript	
  console.	
  
	
  
	
  
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)
Google Tag Manager (Manual in English)

Más contenido relacionado

Destacado

Destacado (14)

Google Tag Manager Advanced - SEOCampixx 2016
Google Tag Manager Advanced - SEOCampixx 2016Google Tag Manager Advanced - SEOCampixx 2016
Google Tag Manager Advanced - SEOCampixx 2016
 
Google Tag Manager - Revolve Conference 2015
Google Tag Manager - Revolve Conference 2015Google Tag Manager - Revolve Conference 2015
Google Tag Manager - Revolve Conference 2015
 
Google Tag Manager
Google Tag ManagerGoogle Tag Manager
Google Tag Manager
 
Universal Analytics and Google Tag Manager - Superweek 2014
Universal Analytics and Google Tag Manager - Superweek 2014Universal Analytics and Google Tag Manager - Superweek 2014
Universal Analytics and Google Tag Manager - Superweek 2014
 
Google Tag Manager - Basic Introduction
Google Tag Manager - Basic IntroductionGoogle Tag Manager - Basic Introduction
Google Tag Manager - Basic Introduction
 
Google Tag Manager (GTM)
Google Tag Manager (GTM)Google Tag Manager (GTM)
Google Tag Manager (GTM)
 
Advanced Form Tracking in Google Tag Manager
Advanced Form Tracking in Google Tag ManagerAdvanced Form Tracking in Google Tag Manager
Advanced Form Tracking in Google Tag Manager
 
Google tag manager-web analytics101
Google tag manager-web analytics101Google tag manager-web analytics101
Google tag manager-web analytics101
 
How Digital Marketer Uses Google Tag Manager To Improve Sales & Leads
How Digital Marketer Uses Google Tag Manager To Improve Sales & LeadsHow Digital Marketer Uses Google Tag Manager To Improve Sales & Leads
How Digital Marketer Uses Google Tag Manager To Improve Sales & Leads
 
Google tag manager
Google tag managerGoogle tag manager
Google tag manager
 
Tricks and tweaks for Google Analytics and Google Tag Manager
Tricks and tweaks for Google Analytics and Google Tag ManagerTricks and tweaks for Google Analytics and Google Tag Manager
Tricks and tweaks for Google Analytics and Google Tag Manager
 
Masterclass Analytics Deep Dive met Google Analytics Advanced en Google Tag M...
Masterclass Analytics Deep Dive met Google Analytics Advanced en Google Tag M...Masterclass Analytics Deep Dive met Google Analytics Advanced en Google Tag M...
Masterclass Analytics Deep Dive met Google Analytics Advanced en Google Tag M...
 
Google Tag Manager for beginners
Google Tag Manager for beginnersGoogle Tag Manager for beginners
Google Tag Manager for beginners
 
Search Marketer's Toolkit for Google Tag Manager and Google Analytics
Search Marketer's Toolkit for Google Tag Manager and Google AnalyticsSearch Marketer's Toolkit for Google Tag Manager and Google Analytics
Search Marketer's Toolkit for Google Tag Manager and Google Analytics
 

Similar a Google Tag Manager (Manual in English)

Similar a Google Tag Manager (Manual in English) (20)

Handbook of e Learning Strategy
Handbook of e Learning StrategyHandbook of e Learning Strategy
Handbook of e Learning Strategy
 
RDGB Corporate Profile
RDGB Corporate ProfileRDGB Corporate Profile
RDGB Corporate Profile
 
Assignment 4,5,6 technological matrixing and types of computers
Assignment 4,5,6 technological matrixing and types of computersAssignment 4,5,6 technological matrixing and types of computers
Assignment 4,5,6 technological matrixing and types of computers
 
Balanced Scorecard - JRM
Balanced Scorecard - JRMBalanced Scorecard - JRM
Balanced Scorecard - JRM
 
Adobe Audience Manager Readiness Playbook
Adobe Audience Manager Readiness PlaybookAdobe Audience Manager Readiness Playbook
Adobe Audience Manager Readiness Playbook
 
Internet marketing plan
Internet marketing planInternet marketing plan
Internet marketing plan
 
Magento Design Guide
Magento Design GuideMagento Design Guide
Magento Design Guide
 
web design company in bangalore
web design company in bangaloreweb design company in bangalore
web design company in bangalore
 
sap fresher jobs BANGALORE ERPTAC - INTERVIEW QUSTIONS
sap fresher jobs BANGALORE ERPTAC - INTERVIEW QUSTIONSsap fresher jobs BANGALORE ERPTAC - INTERVIEW QUSTIONS
sap fresher jobs BANGALORE ERPTAC - INTERVIEW QUSTIONS
 
Sap book for_beginners_and_learners330491372931879
Sap book for_beginners_and_learners330491372931879Sap book for_beginners_and_learners330491372931879
Sap book for_beginners_and_learners330491372931879
 
Cmgt 557 academic adviser ....tutorialrank.com
Cmgt 557 academic adviser ....tutorialrank.comCmgt 557 academic adviser ....tutorialrank.com
Cmgt 557 academic adviser ....tutorialrank.com
 
CMGT 557 Education Specialist |tutorialrank.com
CMGT 557 Education Specialist |tutorialrank.comCMGT 557 Education Specialist |tutorialrank.com
CMGT 557 Education Specialist |tutorialrank.com
 
Cmgt 557 academic adviser ....tutorialrank.com
Cmgt 557 academic adviser ....tutorialrank.comCmgt 557 academic adviser ....tutorialrank.com
Cmgt 557 academic adviser ....tutorialrank.com
 
BetterCloud Whitepaper: Fixing IT's Blindspots – 8 Critical Security and Mana...
BetterCloud Whitepaper: Fixing IT's Blindspots – 8 Critical Security and Mana...BetterCloud Whitepaper: Fixing IT's Blindspots – 8 Critical Security and Mana...
BetterCloud Whitepaper: Fixing IT's Blindspots – 8 Critical Security and Mana...
 
B190p sample
B190p sampleB190p sample
B190p sample
 
Học Google Analytics từ A-Z (Tài liệu tiếng Anh)
Học Google Analytics từ A-Z (Tài liệu tiếng Anh)Học Google Analytics từ A-Z (Tài liệu tiếng Anh)
Học Google Analytics từ A-Z (Tài liệu tiếng Anh)
 
C04 Annex GOPP EN
C04 Annex GOPP ENC04 Annex GOPP EN
C04 Annex GOPP EN
 
Smart Venue Marketing
Smart Venue MarketingSmart Venue Marketing
Smart Venue Marketing
 
Nine Easy Steps for a Quick Customer Experience Tune-up
Nine Easy Steps for a Quick Customer Experience Tune-upNine Easy Steps for a Quick Customer Experience Tune-up
Nine Easy Steps for a Quick Customer Experience Tune-up
 
Magoosh gmat EBooK
Magoosh gmat EBooKMagoosh gmat EBooK
Magoosh gmat EBooK
 

Más de Sergey Bizikin

Calculus One / The Ohio State University (Coursera.org)
Calculus One / The Ohio State University (Coursera.org)Calculus One / The Ohio State University (Coursera.org)
Calculus One / The Ohio State University (Coursera.org)
Sergey Bizikin
 
Google Analytics Platform Principles (Certificate of Completion)
Google Analytics Platform Principles (Certificate of Completion)Google Analytics Platform Principles (Certificate of Completion)
Google Analytics Platform Principles (Certificate of Completion)
Sergey Bizikin
 
Computing for Data Analysis / Johns Hopkins University (Coursera.org)
Computing for Data Analysis / Johns Hopkins University (Coursera.org)Computing for Data Analysis / Johns Hopkins University (Coursera.org)
Computing for Data Analysis / Johns Hopkins University (Coursera.org)
Sergey Bizikin
 
Coursera precalculus 2014
Coursera precalculus 2014Coursera precalculus 2014
Coursera precalculus 2014
Sergey Bizikin
 
eCommerce 201: 5 Strategies & 15 Best Practices You Need to Know to Grow Your...
eCommerce 201: 5 Strategies & 15 Best Practices You Need to Know to Grow Your...eCommerce 201: 5 Strategies & 15 Best Practices You Need to Know to Grow Your...
eCommerce 201: 5 Strategies & 15 Best Practices You Need to Know to Grow Your...
Sergey Bizikin
 
Next-Gen Retail: Mobile and Beyond
Next-Gen Retail: Mobile and Beyond Next-Gen Retail: Mobile and Beyond
Next-Gen Retail: Mobile and Beyond
Sergey Bizikin
 
Marketing sherpa email_marketing_handbook_-_second_edition
Marketing sherpa email_marketing_handbook_-_second_editionMarketing sherpa email_marketing_handbook_-_second_edition
Marketing sherpa email_marketing_handbook_-_second_edition
Sergey Bizikin
 

Más de Sergey Bizikin (11)

Marketing Guide: Аудит контекстной рекламы для маркетологов
Marketing Guide: Аудит контекстной рекламы для маркетологовMarketing Guide: Аудит контекстной рекламы для маркетологов
Marketing Guide: Аудит контекстной рекламы для маркетологов
 
Calculus One / The Ohio State University (Coursera.org)
Calculus One / The Ohio State University (Coursera.org)Calculus One / The Ohio State University (Coursera.org)
Calculus One / The Ohio State University (Coursera.org)
 
Google Analytics Platform Principles (Certificate of Completion)
Google Analytics Platform Principles (Certificate of Completion)Google Analytics Platform Principles (Certificate of Completion)
Google Analytics Platform Principles (Certificate of Completion)
 
Computing for Data Analysis / Johns Hopkins University (Coursera.org)
Computing for Data Analysis / Johns Hopkins University (Coursera.org)Computing for Data Analysis / Johns Hopkins University (Coursera.org)
Computing for Data Analysis / Johns Hopkins University (Coursera.org)
 
Coursera precalculus 2014
Coursera precalculus 2014Coursera precalculus 2014
Coursera precalculus 2014
 
Ecommerce Quarterly - EQ2 2013: Email Engagement
Ecommerce Quarterly - EQ2 2013: Email EngagementEcommerce Quarterly - EQ2 2013: Email Engagement
Ecommerce Quarterly - EQ2 2013: Email Engagement
 
emarsys - Отчет по результатам сравнительного анализа email-кампаний 2012
emarsys - Отчет по результатам сравнительного анализа email-кампаний 2012emarsys - Отчет по результатам сравнительного анализа email-кампаний 2012
emarsys - Отчет по результатам сравнительного анализа email-кампаний 2012
 
From Abandon to Conversion: Why Shoppers Abandon Carts and What Merchants Can...
From Abandon to Conversion: Why Shoppers Abandon Carts and What Merchants Can...From Abandon to Conversion: Why Shoppers Abandon Carts and What Merchants Can...
From Abandon to Conversion: Why Shoppers Abandon Carts and What Merchants Can...
 
eCommerce 201: 5 Strategies & 15 Best Practices You Need to Know to Grow Your...
eCommerce 201: 5 Strategies & 15 Best Practices You Need to Know to Grow Your...eCommerce 201: 5 Strategies & 15 Best Practices You Need to Know to Grow Your...
eCommerce 201: 5 Strategies & 15 Best Practices You Need to Know to Grow Your...
 
Next-Gen Retail: Mobile and Beyond
Next-Gen Retail: Mobile and Beyond Next-Gen Retail: Mobile and Beyond
Next-Gen Retail: Mobile and Beyond
 
Marketing sherpa email_marketing_handbook_-_second_edition
Marketing sherpa email_marketing_handbook_-_second_editionMarketing sherpa email_marketing_handbook_-_second_edition
Marketing sherpa email_marketing_handbook_-_second_edition
 

Último

Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
MarinCaroMartnezBerg
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
amitlee9823
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
amitlee9823
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
amitlee9823
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
amitlee9823
 

Último (20)

Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
 
Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 

Google Tag Manager (Manual in English)

  • 1.   Google  Tag  Manager     Not for programmers           A  quick  guidebook  to  Google  Tag  Manager  for  marketers  and  other   professions  not  connected  with  programming.                   LCS  &  CSI  Poland   Warsaw,  2014    
  • 2.       2   Introduction   Thank  you  for  your  interest  in  this  guidebook  to  Google  Tag  Manager,  which  is  more  and   more  often  implemented  on  websites,  across  all  over  the  world.  The  main  aim  of  its   installation  is  usually  for  a  marketing  department  to  become  independent  from  other   company’s  departments  (like  IT)  and  to  speed  up  changes  on  a  website  within  marketing   and  analytics  measurement  processes.       However,  to  be  able  to  become  really  independent,  one  should  know  how  to  use  this  tool.  It   is  often  connected  with  technical  issues,  which  may  not  be  very  well  known  to  everyone.  A   marketer  does  not  have  to  be  a  programmer  or  a  technical  person,  at  last.     An  idea  has  arisen  on  this  field  to  explain  the  technical  subject  to  non-­‐technical  people  in   the  least  technical  way  ;).       Please  notice,  this  guidebook  is  not  official  manual  approved  by  Google  and  does  not   include  all  options  and  does  not  describe  all  possibilities  of  GTM.  It  is  to  give  the  concept   what  you  can  do  with  it,  understand  its  working  and  make  use  of  it  in  the  most  popular   cases.  A  reader  can  learn  more  and  develop  himself  in  this  area,  if  she/he  wants.         All  information  about  mistakes  and  ideas  for  additional  chapters  are  welcome  J       Have  a  comprehensible  reading   Przemek  Modrzewski   Senior  Analytical  Lead  
  • 3.       3   Contributors       The  e-­‐book  was  created  in  cooperation  of  couple  of  people  from  Poland.   Thanks  to  huge  contribution  of  team  members  it  was  possible  to  write  this  ebook.         Special  thanks  for  help  and  contribution  to:       • Mariusz  Gąsiewski   • Paweł  Matkowski   • Jacek    Ewiak   • Piotr  Rudnicki   • Maciej  Jerzak                 DISCLAIMER     This  quidebook  is  NOT  any  official  manual  approved  by  Google.  This  is  private  work  of   author  and  contributors.  Please  don’t  treat  any  statements  in  this  material  as  official   statement  of  Google.                          
  • 4.       4   Table  of  Contents   Introduction  ...........................................................................................................................  2   Contributors  ...........................................................................................................................  3   Tag  manager  -­‐  introduction  ....................................................................................................  6   How  does  GTM  work  ?  .............................................................................................................................................................  7   Google  Tag  Manager  structure  .............................................................................................................................................  8   What  is  a  container?  ..................................................................................................................................................................  9   What  are  tags?  ..........................................................................................................................................................................  10   What  are  rules?  .........................................................................................................................................................................  10   What  are  macros?  ....................................................................................................................................................................  11   Google  Tag  Manager  on  the  website  ...............................................................................................................................  12   Google  Tag  Manager  installation  –  step  by  step  ........................................................................................................  12   Step  1  –  Create  a  GTM  account  ..........................................................................................................................................  12   Step  2  –  Create  the  first  tag  .................................................................................................................................................  16   Installation  of  basic  scripts  on  the  website  ...........................................................................  22   Installation  of  Google  Analytics  statistics  with  GTM  ...............................................................................................  22   The  first  rule  in  GTM  ...............................................................................................................................................................  28   Testing  a  newly  created  tag  ................................................................................................................................................  30   Installation  of  Google  AdWords  conversion  tracking  with  GTM  ........................................................................  33   The  first  contact  with  macros  in  Google  Tag  Manager  ...........................................................................................  38   What  does  the  macro  consist  of  and  how  is  it  created?  ..........................................................................................  39   Implementation  of  Google  AdWords  remarketing  with  GTM  ..............................................................................  40   Google  Tag  Manager  –  advanced  cases  of  use  .......................................................................  45   Data  Layer  –  what  is  it  and  what  is  it  used  for?  .........................................................................................................  45   What  is  Data  Layer?  ...............................................................................................................................................................  45   How  does  Data  Layer  look  like?  .........................................................................................................................................  48   Adding  variables  and  values  to  Data  Layer  .................................................................................................................  49   Event  tracking  in  Google  Analytics  with  GTM  ............................................................................................................  52   A  button  click  as  an  event  in  Google  Analytics  ............................................................................................................  52   More  buttons  (events)  to  measure  on  one  website  ...................................................................................................  63   Measuring  the  action  on  the  website  with  virtual  pageviews  ..............................................................................  65   Auto  event  in  GTM  (auto  event  tracking)  ..............................................................................  69   Auto-­‐tagging  in  practice  (introduction)  ........................................................................................................................  69   Auto  measuring  of  clicks  on  the  button  (link)  .............................................................................................................  70   A  little  more  about  macros  in  auto  events  ...................................................................................................................  78   Available  macros  and  their  possibilities  .......................................................................................................................  80   Auto-­‐Event  Variable  ...............................................................................................................................................................  81   Macro  Constant  String  ...........................................................................................................................................................  83   Macro  -­‐  Custom  Events  ..........................................................................................................................................................  83   DataLayer  Variable  .................................................................................................................................................................  84   DOM  elements  ............................................................................................................................................................................  84   HTTP  referrer  ............................................................................................................................................................................  87   Javascript  Variable  (Custom  Javascript  code)  .............................................................................................................  87   Random  Number  ......................................................................................................................................................................  88   URL  macro  ..................................................................................................................................................................................  89  
  • 5.       5   Lookup  Table  .............................................................................................................................................................................  90   Measuring  outbound  links  as  auto  events  in  GA  .......................................................................................................  91   Measuring  document  downloads  (e.g.  PDF)  as  auto  events  in  GA  .....................................................................  94   Measuring  clicks  on  images  as  an  event  on  the  website  in  GA  ............................................................................  96   Cross-­‐domain  tracking  with  GTM  (UA)  ......................................................................................................................  100   Dynamic  remarketing  installation  with  GTM  ..........................................................................................................  103   First  method  -­‐  standard  .....................................................................................................................................................  104   The  second  method  –  without  sending  variables  programmistically  ............................................................  112   Ecommerce  tracking  in  GA  with  GTM  .........................................................................................................................  121   Dealing  with  the  bounce  rate  in  Google  Analytics  (real  bounce  rate)  ...........................................................  124   Tags  which  are  not  in  GTM  ..............................................................................................................................................  128   Using  GTM  in  mobile  applications  .......................................................................................  132   Administering  tags  in  application  –  a  few  words  ...................................................................................................  132   Introducing  changes  in  application  (revolution)  ...................................................................................................  133   A  problem  with  mobile  applications  .............................................................................................................................  133   How  does  GTM  work  for  application?  ..........................................................................................................................  134   What  can  be  changed  by  GTM  in  application?  .........................................................................................................  136   A  few  final  thoughts  ...........................................................................................................  141   Migration  plan  to  GTM  .......................................................................................................  142   Conclusion  ..........................................................................................................................  143                          
  • 6.       6   Tag manager - introduction     Tag  manager  is  a  tool  which  makes  easier  to  work  with  numerous  marketing  codes  which   allow  tracking,  measuring  and  also  marketing  actions  for  users  of  our  website.       Thanks  to  GTM  we  do  not  have  to  edit  websites  to  make  any  changes  or  add  new  marketing   codes.  You  need  only  to  paste  the  GTM  code  once  on  our  website.  GTM  answers  the  need  of   control  of  implementation  of  different  codes  on  the  website  by  marketing  not  by  the  IT   department.  We  know  that  for  running  effective  marketing  in  the  Internet  more  and  more   tools  connected  to  our  website  are  necessary.       So  far,  to  introduce  anything,  change  the  website  in  terms  of  marketing  codes,  the   intervention  of  IT  department  or  a  webmaster  has  been  necessary.  Usually  the  process  was   quite  long  then.  Additionally,  lack  of  understanding  how  different  marketing  tools  work  by   the  IT  department  often  caused  wrong  installations.  Another  waste  of  time.       Thanks  to  GTM,  a  marketer  or  other  person  responsible  for  marketing  actions  in  the   Internet  can,  by  their  own,  in  a  few  minutes,  add  any  code  which  is  needed  for  different   tools  working  without  the  need  of  contact  with  the  IT  department.     GTM  has  also  many  other  possibilities,  which  I  will  tell  about  later  in  this  e-­‐book.    
  • 7.       7   How does GTM work?   Simply  speaking,  installing  the  GTM  code  once  in  your  service  (a  code  fragment  on  each   subpage)  we  can  add,  edit,  delete  all  marketing  tags  (remarketing,  analytics,  conversion   tracking  and  many  others)  with  no  need  of  editing  the  website  code.  All  actions  take  place   with  GTM  interface  in  the  web  which  we  log  in  as  easy  as  in  mail  or  Google  Analytics.  It   gives  control  over  marketing  codes  for  people  who  are  not  related  to  the  IT  department   while  website  security  will  not  be  at  risk.  It  also  significantly  shortens  time  needed  for   changes  and  reaction  for  changes  which  are  need  while  running  the  campaign  in  the   Internet  and  reduces  a  resources  (i.e.  IT  department)  needed  every  day  in  marketing   actions  (website  edition,  code  changes,  tag  pasting,  etc.).       What  is  important  and  should  be  clear.  Switching  to  GTM  not  affect  any  reports  and  should   not  have  any  impact  on  data.  Of  course  when  implemented  correctly.         GTM  tool  consists  of  several  elements,  which  we  will  administer:   ● Containers  i.e.  codes  pasted  on  the  website  in  which  all  marketing  codes  (tags)  will   be  stored.     ● Tags  –  tracking  codes  which  we  want  to  place  on  the  website  e.g.  Google  Analytics,   AdWords  conversion  codes,  remarketing  and  any  other  tracking  codes,  not  only   these  ones  from  Google.     ● Rules  –  conditions  in  which  tags  are  to  be  fired.     ● Macros  –macros  are  used  for  making  the  work  with  tags  and  rules  easier,   automating  repetitive  actions.       All  these  elements  will  be  discussed  later  in  this  document.      
  • 8.       8   Google Tag Manager structure     An  account  structure  of  GTM  tool  consists  of  above  mentioned  containers  and  tags  which   belong  to  them,  as  well  as  rules  and  macros.             When  creating  the  GTM  account  you  can  see  the  menu  on  the  left.  There  are  three  elements   in  it  –  tags,  rules  and  macros.  All  tags  (marketing  codes  added  to  the  website  by  GTM)  and   rules  and  macros  created  by  us  will  be  stored  here.  Creating  each  of  these  items  takes  place   with  the  help  of  menu  in  the  center  of  interface,  where  we  see  button  “new”.  We  have  said   in  short,  at  the  beginning,  what  elements  of  the  GTM  account  are  and  what  they  are  used   for,  now  let’s  explain  this  in  details.  So,  once  more,  what  actually  containers,  tags,  macros   and  rules  are.     GTM  account   Container   Tags   Rules   Macros  
  • 9.       9       What is a container?     All  tags  are  stored  in  the  container.  The  container  is  a  set  of  all  tags  which  are  used  and   pasted  on  the  same  website  with  GTM.  The  container  should  be  pasted  on  every  webpage   of  our  website,  similar  to  normal  tracking  code  e.g.  Google  Analytics.  Only  then  we  can  add   tags  of  every  tracking  other  tools,  e.g.  Analytics  or  Adwords  from  the  level  of  GTM  interface.         In  this  way,  we  edit  our  website  only  once,  paste  a  container  in  the  right  place  (the  best  
  • 10.       10   directly  under  the  tag  <body>,  which  opens  website  content)  and  then  all  other  codes  are   added  to  website  through  the  container  with  no  need  of  interference  in  a  website’s  source   code.         Remember!  The  container  should  be  installed  on  each  subpage  of  our  service.  As,  for   example,  Analytics  code.  It  is  so  important  that  in  the  case  of  omitting  any  subpage  there  is   no  possibility  to  add  tags  with  GTM  on  it.  That’s  why  we  will  not  be  able,  for  example,  to  use   Analytics  code  on  it,  if  we  want  to  install  a  tracking  code  with  GTM.     What  are  tags?       Tags  are  tracking  codes  which  we  want  to  paste  on  a  website  with  the  GTM  tool.  The  Tag  is   a  script,  e.g.  Google  Analytics  that  we  paste  usually  in  the  website’s  code.  It  can  be  also   AdWords  conversion  tag,  remarketing  tag  or  other  marketing  tool  tag  which  require  adding   some  fragment  of  the  code  on  our  website.     What are rules?     Rules  are  nothing  else  than  principles  when  a  given  tag  is  to  be  fired  in  the  container.  For   example,  if  we  added  a  tag  of  AdWords  conversion  tracking,  we  would  not  like  to  fire  this   code  on  each  subpage  of  the  service  but  only  on  the  website  which  confirms  doing  a   desired  action  by  visitor  –  purchase,  e-­‐book  download,  filling  in  a  form,  etc.     Such  a  website  can  be  determined  as  a  last  website  in  some  process  to  aim,  on  which  it  is   information  confirming  this  action,  for  example  “Thank  you  for  purchase”.  Its  URL  address   can  look  i.e.    www.my-­‐website.pl/thankyou.html     To  count  a  conversion  in  AdWords,  when  someone  achieves  the  end  of  conversion  path  and  
  • 11.       11   sees  the  above  website,  we  must  create  a  rule  in  GTM  which  will  define  a  condition  of  firing   the  conversion  code.  The  condition  (rule)  could  say  as  follows:  Fire  the  Adwords   conversion  code  when  there  is  a  word  „thank  you”  in  URL  address.  In  other  case  the  code   will  not  be  fired  and  the  conversion  will  not  be  counted.       What are macros?     A  definition:  Macros  are  the  pairs  "name-­‐value"  whose  value  is  completed  in  the  course  of   action.  For  example,  an  initially  defined  macro  named  “URL”  is  defined  in  this  way  that  its   value  of  actual  URL  of  the  website.  This  is  a  definition.         Because  macros  are  a  bit  more  complicated  elements  we  will  deal  with  them  a  little  later  by   the  way  of  more  advanced  use  of  GTM.  They  are  not  required  for  simple  standard   installations  but  we  rather  cannot  ignore  its  importance.       Summary     So,  how  can  all  these  elements  be  easily  summarized  while  explaining  their  relationships   between  them?     Tags  are  codes  which  we  want  to  place  on  the  website  (e.g.  Google  Analytics  code),  rules   are  used  for  defining  when  a  given  tag  is  to  be  fired  (e.g.  GA  code  is  to  be  fired  on  all  pages),   while  macros  are  used  for  automating  and  simplifying  work  with  data  which  are  necessary   for  tag  and  rule  working  on  our  website.  
  • 12.       12   Google Tag Manager on the website       Google  Tag  manager  can  be  used  in  the  case  of  most  codes  which  we  have  to  add  to  our   website  to  benefit  from  such  mechanisms  like  statistics  of  website  views,  conversion   tracking  or  other  data  needed  for  marketing  actions.       In  the  following  steps  we  will  move  to  the  process  of  correct  installation  of  GTM  on  the   website  by  implementing  the  most  popular  tags.  Meanwhile,  we  will  explain  all  functions   and  concepts,  which  may  not  be  clear  in  official  GTM  help.     Google  Tag  Manager  installation  –  step  by  step       Google  Tag  Manager  installation  is  very  simple  and  includes  few  steps.   They  are:  creating  an  account,  creating  a  container,  settings  configuration  and  installation   of  first  tags  i.e.  tracking  codes.  Although  the  first  actions  are  quite  simple,  the  questions  will   arise  just  surely  at  the  beginning  of  actions.  I  will  try  to  foresee  them  here  and  explain  ;).         Step 1 – Create a GTM account   This  action  is  very  simple.  You  need  only  to  enter  https://www.google.com/tagmanager/ and  create  an  account.     First  container   What  a  container  is  we  have  explained  at  the  beginning  of  this  e-­‐book.  Now  it  is  time  for  its   creation  and  installation.      
  • 13.       13       A  good  practice  is  just  to  name  a  container  as  we  have  named  our  account  but  it  is  not   obligatory.  Perhaps  we  will  have  soon  several  containers,  so  it  is  important  to  create  the   terminology  system.  The  subject  of  terminology  is  essential  because  our  account  with  time   will  be  bigger  as  we  will  add  next  tags,  macros  and  rules.  We  will  have  to  know  what  they  are   used  for.  Then  we  have  to  choose  where  we  want  to  use  our  container,  on  a  website  or  in   the  mobile  application.  It  is  also  one  of  the  advantages  of  GTM  that  we  can  use  it  to   administer  tags,  and  even  administer  changes  in  mobile  applications.  We  will  write  more   about  it  later.       If  I  have  a  lot  of  domains,  subdomains,  so  how  many  containers  do  I  need?  How  many   containers  should  I  create?   It  was  my  first  question,  which  came  to  my  mind  while  creating  the  first  GTM  account.   Generally,  if  I  have  a  lot  of  domains  but  they  are  not  connected  with  one  another,  it  is  a   good  practice  to  keep  the  principle  one  domain  –  one  account  -­‐  one  container.  It  allows   keeping  an  order  while  it  does  not  disturb  to  administer  them  because  we  can  administer  a  
  • 14.       14   lot  of  GTM  accounts  from  the  level  of  one  login  and  password.  It  is  seen  on  the  image  below   where  with  one  login  I  have  an  access  to  many  GTM  accounts.         Let’s  come  back  to  the  installation  of  the  first  container.  Because  actually  we  implement   GTM  on  the  website,  we  choose  an  option  of  a  container  just  for  the  website.  If  we   implement  tag  manager  in  application,  we  will  choose  a  suitable  version  of  “mobile   applications”.     When  choosing  a  version  for  a  website  an  available  container  will  occur  to  be  pasted  on  our   website.    
  • 15.       15     We  copy  a  ready  code  of  the  first  container  as  a  whole  and  paste  it  on  our  website.     The  best  place  to  paste  a  container  code  is  a  place  directly  below  the  tag  which  opens  the   website  content  -­‐  <body>.  We  will  find  it  easily  in  the  website  code  by  the  option  “search  in   content”.  We  can  see  how  it  looks  like  for  a  sample  website  by  clicking  the  right  mouse   button  on  the  website  content  and  choosing  “Show  the  website  source”.          
  • 16.       16   What  if  we  cannot  put  the  GTM  code  in  the  place  described  above?   Remember  that  the  best  place  for  a  container,  which  guarantees  the  best  data  collecting,  is   the  place  directly  below  the<body>  tag.     Unfortunately,  there  is  no  guarantee  that  our  codes  implemented  by  GTM  will  be  called   correctly  if  we  change  the  place  of  the  container.  Especially  I  do  not  recommend  pasting  the   container  code  in  the  <head></head>  section  because  the  script  includes  “iframe”  which   can  cause  an  unexpected  action  of  the  browser.     Step 2 – Create the first tag As  we  have  seen  in  the  image  from  p.  13,  after  creating  the  first  container  we  can  see,  at   once,  several  built-­‐in  tags  at  our  disposal  ready  to  be  installed  on  our  website.  As  you  can   see  the  most  popular  Google  tags  are  there,  we  have  also  available  Doubleclick  tags.  There   are  also  several  tags  of  other  companies  available  in  GTM.  In  addition,  there  are  custom   tags  (Custom  HTML)  thanks  to  which  we  can  actually  place  every  other  tag  on  our  website,   even  if  it  is  not  normally  on  the  standard  GTM’s  tag  list.  We  will  discuss  implementation  of   the  most  popular  tags  in  details  in  a  moment.  Now  we  will  stop  for  a  while  and  discuss   settings  and  functionality  of  the  account,  which  we  will  use  in  a  while.       Settings  and  functionality  of  the  GTM  account     While  creating  the  GTM  account  and  the  first  container  we  have  one  user  (i.e.  ourselves).  In   GTM  account  we  can  add  next  containers  and  users.  As  we  can  see  below  we  can  use  the   “New”  button  and  add  a  user  or  a  container.    
  • 17.       17         According  to  what  I  have  written  before,  a  good  practice  is  to  keep  a  rule  –  one  account,  one   domain,  one  container.  However,  we  can  ignore  this  principle  in  different  cases.       Many  domains  we  treat  as  the  whole.   Then  we  can  use  one  container  for  many  domains  because  rules,  tags  and  macros  cannot  be   divided  between  containers.  If  all  domains  are  to  be  configured  in  a  similar  way,  the  use  of   one  container  is  applied.        Many  tags  on  one  domain.   If  we  have  plenty  of  tags  to  handle,  it  is  much  easier  to  administer  them  if  we  divide  them   into  two  containers  or  more.  It  gives  us  bigger  clarity  what  and  when  is  to  be  fired  and  it   makes  also  that  the  container  itself  is  less  loaded  (it  is  smaller).  It  is  possible  to  e.g.   segregate  tags  according  to  a  type  and  a  tool.  However  it  is  quite  rare.    
  • 18.       18   Many  users  with  different  access  rights   Access  rights  for  users  can  be  granted  on  the  container  level.  Thus,  if  we  want  to  limit  the   access  to  other  domain  or  tag  configuration  we  have  to  use  more  containers  and  give  the   next  users  access  and  rights  on  their  level.  We  can  grant  accesses  of  different  rights:   browsing,  browsing  and  editing  or  browsing,  editing  and  publishing  (full  access)   Test  environment   A  good  idea  is  to  use  different  containers  while  testing  implementation  of  new  tags  or  rules.   Especially  for  big  services,  a  wrong  configuration  and  loss  of  data  for  some  period  can  be   painful.    Hence,  it  is  worth  paying  attention  to  it  during  implementation.  At  the  moment  of   implementation  it  is  a  good  idea  to  make  use,  especially  in  Google  Analytics  and  other   statistics  issues,  of  the  Lookup  Table  macro,  which  we  will  discuss  later  in  this  e-­‐book.  At   the  very  end  you  can  find  a  proposed  migration  plan  to  Google  Tag  Manager.     "Settings"  tab     In  the  "settings”  tab  there  is  an  identifier  of  a  container  and  a  container  name,  which  we   can  change  in  any  time.     "Containers"  tab     In  the  "Containers"  tab  we  can  see  currently  created  containers  on  the  account,  number  of   tags  created  for  a  given  container,  our  rights  to  edit  a  container  and  a  number  of  users   assigned  to  it.     Choosing  our  existing  container,  which  is  called  "my  test  container”  in  our  example,  we   proceed  to  the  heart  of  Tag  Manager  itself  i.e.  to  container  settings.    
  • 19.       19       As  we  can  see  in  the  menu  on  the  left,  there  are  tabs  concerning  tags,  rules  and  macros.  We   have  said  about  these  elements  before  and  we  will  talk  about  them  many  times  further.  We   will  be  using  the  left  menu  very  often.  In  the  center,  we  have  a  view  of  tags,  rules  and   macros  created  by  us  under  grey  tabs.     Now  the  most  important  thing,  at  this  point,  is  to  understand  the  matter  of  a  version   and  a  container  type.  So,  what  is  all  about?     Adding  a  tag  or  a  rule  to  the  container  or  editing  anything  in  GTM  we  will  not  see  changes   on  our  website.  Nothing  will  be  changed.  To  do  this  we  have  to  publish  the  changes.  Thus,   in  item  3  in  the  image  above  we  can  see  a  container  as  unpublished.  To  publish  it  and   introduce  the  changes  which  will  have  reflection  on  our  website  first  we  have  to  create   another  version  of  a  container  (item  2).  Then  we  can  publish  the  current  version.  It  will   then  go  live.  Any  created  version  can  be  seen  below  the  menu  on  the  left.  You  can  come   back  to  the  version,  if  there  is  such  a  need.  Thanks  to  versions  we  do  not  override  changes   irretrievably.        
  • 20.       20       In  the  image  from  website  17  you  can  see  the  item  1,  that  is  a  function  of  preview.  The   “Preview”  function  is  one  of  functionalities  used  very  frequently  while  adding  or  editing   tags  or  changing  other  settings.  Thanks  to  the  “Preview”  function  we  can  preview  if   changes  introduced  by  us  work  properly  on  the  website.  There  are  three  options  of   preview  of  changes  available.       ● Preview  –  It  allows  us  to  preview  the  website  with  changes  applied  by  us.  It  means   that  after  choosing  a  "Preview”  option  we  can  enter  our  website,  refresh  it  and  check  if   changes  introduced  by  us  work  e.g.  in  the  programmers'  console  in  Chrome  browser  or  in   Firebug  tool  in  Firefox.  Because  we  have  not  created  a  version  in  GTM  yet,  changes  on  the   website  are  seen  only  by  us.  After  switching  off  the  preview  option  (a  yellow  bar  at  top  of   the  screen),  changes  will  stop  working  on  the  website.    
  • 21.       21         ● Debug  –  the  option  probably  the  most  frequently  used.  It  allows  to  add  to  “Preview”   option  an  auxiliary  console  which  will  show  us  if  and  what  tags  will  work  on  our  website   after  creating  a  new  version.          
  • 22.       22     ● Share  –  A  "Share”  option  allows  us  to  create  a  unique  url  address,  which  we  can  send   to  a  person  who  is  not  related  to  our  GTM  account.  Thanks  to  this  address  the  person  who   will  use  a  link  given  by  us  will  be  able  to  see  also  working  changes,  which  are  not  published   yet  in  GTM.       Installation of basic scripts on the website   We  now  know  the  basic  settings  of  Google  Tag  Manager.  We  can  move  to  the  installation  of   tracking  scripts  on  our  website  with  GTM.  We  will  start  from  the  most  standard  tags   (scripts)  and  then  we  will  go  into  more  advanced  ways  of  using  this  tool.       Installation of Google Analytics statistics with GTM   Using  Tag  Manager  (GTM)  to  track  traffic  on  the  website  with  Google  Analytics  is  one  of   most  frequent  cases.  The  simplest  installation  is  not  complicated  but  more  advanced   aspects  of  tracking  like  e.g.  event  tracking  may  cause  some  problems.  Thus,  we  will  deal   also  with  these  more  advanced  aspects  in  further  steps.  Now  we  will  make  a  standard   installation.       In  the  previous  part  of  this  e-­‐book  we  have  created  the  GTM  account  and  the  first  container   as  well.  Just  after  creating  the  container  we  have  an  opportunity  to  move  at  once  to  create   the  first  of  the  most  popular  tags.    
  • 23.       23         We  can  start  to  create  them  at  once  or  do  this  after  installing  the  container.     We  have  to  do  the  following:     1. Create  Google  Analytics  tag     2. Define  rules  for  tag  to  be  fired     3. Test  a  newly  created  tag     4. Create  a  version  of  the  container     5. Publish       Let’s  start  from  the  beginning.     Ad  1.  Create  Google  Analytics  tag     We  start  creating  a  tag  from  giving  the  name  to  it.  It  is  important  because  when  there  are   many  tags  it  will  be  easier  to  administer  them  if  tags  have  properly  matched  names.   A  good  practice  is  to  construct  names  based  on  a  type  of  a  tool  e.g.  Google  Analytics  and  a  
  • 24.       24   function,  which  a  given  tag  is  to  fulfill.  The  first  tag  which  we  will  create  is  the  tag  named   GA  (Google  Analytics)  –  Pageviews,  because  this  tag  will  be  responsible  for  tracking   displays  of  our  website,  that  is  a  basic  function  of  Google  Analytics.  All  other  functions  of   GA  will  be  also  used  but  we  will  use  next  tags  to  it.  We  will  talk  about  it,  for  example,  by  the   way  of  event  tracking  on  the  website  with  GTM.           Another  step  is  to  choose  the  kind  of  a  tag  from  the  list  of  standard  tags  serviced  by  GTM.   We  choose  Google  Analytics  from  a  pull-­‐down  menu.  Now  we  can  choose  from  Classic  GA   and  a  new  version  that  is  Universal  Analytics.  For  the  need  of  this  example  we  will  use  a   classic  version.  The  choice  of  the  second  one  will  not  have  any  influence  on  the  way  of   creating  and  administering  the  GA  tag,  so  we  can  choose  the  version  at  will.    
  • 25.       25       As  you  can  see  above  we  have  many  more  standard  tags  available,  which  we  can  use  with   GTM.  If  our  tag  is  not  on  the  list  we  can  implement  it  with  custom  tags.  We  will  talk  about  it   later.       In  the  next  step  we  have  to  give  an  ID  number  of  our  account  in  Google  Analytics,  which  we   are  going  to  install  with  GTM.  We  can  find  ID  in  our  Analytics  account.       ***OFF  TOPIC***     As  you  can  see  in  the  image  above,  on  the  right  next  to  the  ID  number  of  the  account   introduced  in  the  "Web  property  ID”  column  there  is  a  grey    "Lego  brick”.  This  “brick"   indicates  the  possibility  of  using  macros.  I  have  mentioned  before  that  macros  are  used  to   simplify  and  automate  the  work.  We  will  make  use  of  a  macro  for  the  first  time  to  simplify   using  the  ID  number  of  the  GA  account  in  next  cases  of  using  this  number  ID  on  our   account.        
  • 26.       26   What  to  do  then?     1. Mark  the  ID  number  and  copy  it  to  the  storage  (ctrl  +  C)   2. Click  on  the  "brick”  and  choose  "New  macro”  at  the  bottom.   3. Add  the  macro  name  that  we  know  what  this  macro  is  used  for,  choose  the   type  as  "Constant  String”  and  a  value  as  an  ID  of  our  Google  Analytics  account.  There   are  many  macro  types  and  with  time  we  will  make  use  of  different  than  “Constant   String”.  Now  we  are  not  dealing  with  it.         After  that  we  can  use  a  given  macro  and  thanks  to  this  we  do  not  need  to  remember  the  ID   of  Google  Analytics  account  with  the  next  tags  which  are  to  be  installed.    
  • 27.       27     It  is  one  of  the  simplest  methods  of  using  macros  but  thanks  to  this  we  will  not  make   mistake  while  pasting  codes  and  what  is  more,  we  do  not  waste  the  time  for  checking  a   given  ID  many  times.  I  will  emphasize  once  more  that  Analytics  tag  has  its  types,  which  are   responsible  for  different  types  of  tracked  data.  So,  if  we  want  to  track  events  and   ecommerce  transactions  by  GTM,  we  will  have  to  use  three  tags:  for  pageviews  (standard),   for  events  and  for  transactions.    We  need  to  give  the  ID  number  of  the  GA  account  each  time   we  create  a  tag  for  given  GA  account.  Thanks  to  the  created  macro  we  do  not  have  to   remember  ID  of  account.  So  we  used  macro  for  the  first  time.  It  is  simple  way  but  very   useful  and  we  will  use  it,  in  this  way,  quite  often.       ***OFF  TOPIC***     Let's  come  back  to  creating  our  Tag.    After  choosing  a  type  of  the  tag  as  Google  Analytics,   we  can  see  the  option  “Enable  Display  Advertising  Features”  below.  This  option  is  used  for   switching  on  possibilities  to  make  use  of  remarketing  in  Google  Analytics  and  demographic   reports.  In  practice  this  option  adds  to  the  code  a  Doubleclick  cookie,  which  is  just   responsible  for  these  additional  possibilities  of  Google  Analytics.              
  • 28.       28   Track  type     I  have  mentioned  about  track  types  a  little  earlier  by  the  way  of  creating  the  first  macro.   There  can  be  many  track  types  depending  on  a  kind  of  a  tag.  Even  in  the  case  of  Google   Analytics  we  have  them  quite  a  lot.         Website  View  tracking  is  of  course  a  standard  type  but  in  the  further  part  we  will  use  next   types,  just  as  we  will  want  to  start  the  following  functionalities  of  Google  Analytics  with   GTM,  such  as,  for  example,  event  tracking  on  the  website  or  traffic  tracking  between   domains.  We  will  talk  about  it  further  on.       The first rule in GTM   At  this  moment  we  have  just  almost  configured  the  first  tag.  The  only  thing  which  is  left   before  testing  and  publishing  it  is  to  add  a  rule  which  will  allow  us  to  set  the  rules  when  
  • 29.       29   GTM  has  to  fire  a  given  tag.     Rules  are  set  in  interface  in  the  right  upper  corner.  To  be  fired  each  newly  created  tag  will   need  a  rule.  It  will  not  work  without  the  rule.  What  we  have  to  do  is  to  wonder  now  when  a   given  tag  is  to  be  fired.  Our  first  Google  Analytics  tag  is  to  be  fired  on  each  subpage  of  our   service.  It  is  quite  obvious  because  we  want  to  collect  data  about  all  pageviews  on  our.   Then  we  have  to  set  the  rule  which  will  fire  a  tag  on  each  website  of  the  service.           When  we  want  to  add  a  new  rule  a  window  of  its  choice  will  occur.  We  can  choose  rules   that  already  exist  and  which  we  have  created  earlier  for  other  tags  from  the  list  or  create  a   new  one.  In  the  case  of  new  accounts  and  containers  we  have  to  create  rules  from  the   beginning.     As  you  can  see,  a  rule,  which  we  are  interested  in,  is  already  available  in  standard  –  fire  it   on  each  subpage.  You  have  to  only  mark  it,  and  it  is  ready.  In  the  case  of  creating  new  rules   we  have  to  create  a  rule  about  conditions,  which  have  to  be  satisfied  so  that  a  given  tag   could  be  fired.  We  will  deal  with  creating  more  advanced  rules  later  in  this  e-­‐book  by  the   way  of  creating  a  tag  for  tracking  AdWords  conversion  where  we  will  describe  creating  of   rules  more  extensively.    
  • 30.       30     Testing  a  newly  created  tag     We  have  created  the  first  Tag.  Before  we  publish  it  on  the  website  it  is  worth  testing  and   seeing  if  it  works.  As  you  can  see  below,  our  version  of  the  tag  is  unpublished.  It  means  that   changes  introduced  by  us  did  not  come  into  effect.  It  is  always  worth  paying  attention  to  it   because  it  is  one  of  more  frequent  mistakes  which  are  made  by  not  only  beginners.  If  we  do   not  publish  changes  (a  new  container  version)  we  will  not  see  them  live.  They  could  be   seen  only  in  Preview  –  Debug.           However,  before  we  publish  anything  we  have  to  verify  it.  We  choose  the  “Preview”  option   and  then    “Debug”  option  (see  p.17).  Let’s  move  to  our  website  in  a  new  tab  of  a  browser   and  refresh  the  view.  Thanks  to  this  a  console  will  occur  at  the  bottom  of  the  screen  with   information  if  our  tag  is  fired  under  conditions  defined  by  rules.    
  • 31.       31     You  can  see  in  the  console  that  our  tag  has  been  fired.  Everything  works.  Now  we  can  come   back  to  the  tab  with  opened  Tag  Manager  and  publish  the  version.  To  do  this  we  create  a   new  version  and  publish  it.  A  new  version  is  created  now  (in  our  case  version  no.  4).       Pay  attention  to  a  yellow  bar  at  the  top  with  a  message  about  the  preview  on  our  website.  If   we  now  go  to  the  website  we  will  see  all  the  time  the  console  at  the  bottom  of  our  website.   Thus,  if  we  finish  the  work  we  can  quit  this  mode  (For  clarity,  a  preview  mode  is  seen  only  by  
  • 32.       32   us,  other  users  cannot  see  it.  They  could  see  it  if  we  would  sent  them  a  special  link  to  the   preview,  which  I  have  written  about  before).           Next  steps     Our  first  tag  has  been  published.  Now,  we  are  ready  to  install  next  tags  which  will  be   needed  to  track  our  advertising  actions  and  not  only.  However,  before  we  move  to  the  next   tags,  we  should  mention  about  a  very  useful  tool  which  will  allow  us  to  see  if  our  website,   or  any  other,  has  installed  and  working  tags.  This  tool  is  Tag  Assistant.  It  is  a  simple  and   friendly  plug-­‐in  to  Chrome  browser.           Thanks  to  Tag  Assistant  we  can  easily  verify  what  tags  are  working  on  the  website  being   viewed  by  us.  We  will  get  guidelines  and  suggestions  concerning  tag  implementation.  Tag   Assistant  is  a  tool,  which  is,  we  can  say,  obligatory.  Assistant  can  be  downloaded  free  from   Google  Chrome  shop.    
  • 33.       33   Installation of Google AdWords conversion tracking with GTM   In  the  previous  chapter  we  managed  to  create  the  first  tag,  which  is  used  for  tracking   displays  with  Google  Analytics.  We  have  created  the  account,  the  container,  then  the  tag   where  we  have  chosen  its  type  (Google  Analytics)  and  defined  when  our  tag  has  to  be  fired   (rule).  In  this  step  we  will  create  a  tag,  which  will  service  AdWords  conversion  tracking.       AdWords  or  other  conversion  tracking       What  do  we  actually  need  for  conversion  tracking?  We  need  to  measure  traffic  on  the   website  or  a  number  of  actions  which  will  confirm  that  the  conversion  took  place.    For   example,  a  classical  example  of  a  conversion  are  displays  of  the  website  “Thank  you  for”  –   purchase,  contact,  etc.  That  is  the  website  which  is  displayed  only  when  a  user  did  some   action  desirable  by  us,  for  example,  filling  in  the  form.  A  classical  conversion  path  seems  to   look  more  or  less  like  this:         Main  website  -­‐>  category  website  -­‐>  product  website  -­‐>  form  -­‐>  payment  -­‐>thank  you.       To  track  the  conversion  we  need  to  track  the  last  website  -­‐  “Thank  you”  with  the  special   code  called  the  conversion  tracking  code.  During  visits  from  AdWords  ads,  the  code  is   compared  to  a  cookie,  which  was  granted  to  users  at  the  moment  of  clicking  on  the  advert.   If  data  from  the  cookie  matches  data  from  the  tracking  code,  a  conversion  is  counted.   It  is  a  description  of  working  in  short,  but  it  is  only  to  remind  it  and  to  eliminate  the  mental   shortcuts  of  the  author.       To  track  conversions  we  need  an  address  of  the  "Thank  you”  website  and  we  have  to  place   a  suitable  conversion  code  on  this  website.  So  far,  it  has  been  as  follows:  
  • 34.       34     1.  We  have  generated  a  conversion  code  in  AdWords  account   2.  We  have  copied  the  code.   3.  We  have  edited  the  "Thank  you”  website     4.  We  have  pasted  the  conversion  code  in  the  code  somewhere  at  the  end  of  the  website   just  before  the  closing  </body>  tag.       Implementation  of  the  conversion  tracking  code  with  GTM     At  present,  thanks  to  GTM,  we  do  not  have  to  edit  the  website  to  implement  conversion   tracking  code.  You  only  have  to  create  a  suitable  tag  in  GTM  and  give  it  proper  rules.  As  it  is   assumed  the  code  is  to  be  fired  on  “Thank  you”  pages.  So  to  create  the  conversion  tag  we   have  go  through  a  few  steps:     1.  Create  a  conversion  in  AdWords  account   2.  Create  a  conversion  tag  in  GTM   3.  Give  a  rule  when  the  code  is  to  be  fired   4.  Test  and  publish  the  new  container  version.         Ad1.  Creating  a  conversion  in  AdWords  account     To  start  tracking  the  effectiveness  of  our  actions  thanks  to  conversions,  first  we  have  to   create  such  a  conversion  in  our  AdWords  account.  We  have  copied  the  whole  code  before   and  pasted  it  onto  the  website.  Now  we  need  only  two  things  –  the  conversion  ID  and  its   label.  To  do  this  we  need  to  preview  the  code  of  conversion  created  by  us  in  AdWords   interface  (Tools  tab  -­‐>  Conversions  -­‐>  code).    
  • 35.       35       Ad  2.    Creating  a  conversion  tag  in  GTM     We  already  have  ID  and  the  label  of  the  conversion,  thus,  we  can  move  to  create  a   conversion  tag  and  start  to  track  a  conversion  with  GTM.    
  • 36.       36       1.  Create  a  new  tag  in  our  container   2.  Give  it  a  proper  name   3.  As  a  type  choose  AdWords  Conversion  Tracking   4.  Add  copied  ID  and  label  from  the  conversion  code  generated  before  (a  conversion   value  is  non-­‐obligatory  and  we  do  not  have  to  give  it).   5.  Add  a  rule  when  the  code  is  to  be  fired.       Everything  is  clear  to  the  step  no.  4  but  in  the  step  no.  5  we  have  to  stop  for  a  while  to  say   something  more  about  rules.  Remember  that  we  have  to  track  the  conversion  on  the   website  of  “Thank  you”  type.  In  our  case  the  website  of  this  type  is  the  website  after  filling   in  the  form  whose  address  is  www.test_website.com/thankyou.html.   We  want  a  conversion  code  to  be  displayed  only  on  this  website.  We  do  not  want  this  code   to  be  active  on  any  other  website.  Therefore,  we  create  the  rule,  which  will  guarantee  this   to  us.     We  choose  "Add  the  rule”  and  then  "Create  a  new  rule”.  As  you  can  see  in  the  image  below,   rules  are  created  from  two  parts:  variable  (macros)  and  value.  In  this  case  we  choose   Conversion  value  (optional)  
  • 37.       37   {{url}}  macro  which  is  responsible  for  considering  URL  addresses  and  values  of  this   variable  that  is  the  address  of  our  website  –  thankyou.html.  Between  these  parts  we  choose   a  logical  parameter,  which  will  be  a  principle  of  their  combination.   .       In  our  case  the  whole  condition  (rule)  says  as  follows:  If  the  URL  address  includes  the   "thankyou.html"  string  of  characters,  fire  the  conversion  tracking  tag.       Of  course  we  can  choose  other  logical  conditions  such  as  "equals”,  "does  not  equal”,  "ends”,   etc.    
  • 38.       38   Actually  we  could  stop  here  because  we  have  done  everything  correctly.  Now  we  have  to   test  (Debug,  Preview)  possibly  if  everything  works  properly,  create  a  new  version  and   publish  it.  Voila,  another  tag  on  our  website  has  been  installed.     However,  there  is  one  detail  yet  which  was  not  explained  here  fully.  Macros.   Indeed,  we  have  used  {{url}}  macro.  The  question  is,  where  is  it  from  and  what  is  it  about?  I   will  try  to  explain  the  subject  of  macros  here  but  their  use  will  be  used  in  most  of  our   actions  in  GTM  so  the  subject  of  macros  will  be  present  almost  in  every  example.     The first contact with macros in Google Tag Manager   As  I  have  mentioned  at  a  very  beginning,  macros  are  used  for  automating  and  simplifying   work  with  data  in  GTM.  It  is  quite  a  general  description  but  it  is  enough  for  the  beginning.   Macros  are,  in  fact,  links  between  data  on  the  website  and  our  tags,  macros  may  convey   values  between  a  website  and  individual  tags,  macros  may  also  be  a  basis  for  building   conditions  of  firing  tags  (in  this  way  we  have  used  {{url}}  macro).  In  the  previous  chapter   we  have  created  also  the  first  macro  where  the  value  was  the  ID  number  of  our  Analytics   account.   If  we  want  to  create  the  rule  in  which  there  are  variable  values  depending  on  a  situation,   we  will  use  the  macro  then.    Like  URL  addresses  have  a  lot  of  variables  and  all  are  taken   into  consideration,  we,  in  our  example,  have  placed  the  value  “thankyou.html.”  for  our   {{url}}  macro.         This  all  constitutes  an  opinion  that  macros  are  one  of  the  most  essential  elements,  which   we  have  to  deal  with  in  GTM.  I  think  that  even  if  a  macro  is  something  abstract  at  this   moment,  it  will  not  be  when  we  will  consider  many  examples.      
  • 39.       39   Below,  there  is  a  list  of  all  macros,  which  are  currently  on  my  account.  A  part  of  them  is   standard  and  present  from  the  beginning  on  the  account,  the  rest  need  to  be  created.  So  far   we  have  created  one  macro  concerning  ID  of  Analytics  account  to  make  the  work  easier,  we   have  used  one  ready  {{url}}  macro  to  define  the  rule.  Now  there  is  a  turn  to  explain  more   about  macros.         What does the macro consist of and how is it created?   As  you  can  see,  the  macro  always  consists  of  two  braces  and  a  name,  e.g.  {{url}}.   In  this  way  we  always  use  macros  within  GTM.     Each  macro  has  its  type.  It  can  be  a  macro,  which  will  be  used  for  defining  url  addresses,   but  there  are  several  types  of  macros.  For  example,  the  macro,  which  we  have  created  at   the  beginning  for  the  need  of  ID  account,  was  simply  a  string  of  characters  “Constant   string”.    
  • 40.       40       As  you  can  see  in  the  image  above  there  are  quite  a  lot  of  macros.  So  far  we  have  used  two   macros  but  we  need  to  use  a  greater  number  of  them.     We  will  create  macros  up  to  date,  if  we  need  to  combine  data  from  the  website  with  our   tags.  Depending  on  what  a  given  macro  will  have  to  provide,  we  will  use  such  a  macro.     I  think  that  we  can  now  put  the  subject  of  macros  aside.  In  the  next  examples  we  will  come   back  to  it  many  times  yet  and  explain  their  work   Implementation of Google AdWords remarketing with GTM   So  far  we  have  placed  two  very  important  tags  on  our  website  –  Google  Analytics  and  the   tracking  code  of  AdWords  conversion.  Another  important  and  what  is  more,  basic  code,   which  is  commonly  displayed  on  pages,  is  a  remarketing  code.       In  this  e-­‐book  I  will  not  explain  what  remarketing  is  because  this  subject  is  not  the  subject   of  this  publication.  We  can  say  only  that  the  remarketing  code  is  a  code  which  is  used  for  
  • 41.       41   bringing  back  users  on  the  website  with  the  help  of  adverts,  users  who  did  or  did  not  do   any  action  on  our  website  e.g.  did  not  buy  any  product  and  left  our  service.  It  is  a  classical   example  but  there  are  lots  of  applications  of  remarketing.  We  will  focus  here  on  a  technical   side  that  is  on  implementation  of  the  remarketing  code  on  particular  pages  of  our  service.       Creating  a  remarketing  tag   As  in  the  previous  chapters,  we  create  a  new  tag  in  GTM  and  choose  its  kind  as   remarketing.  We  also  have  to  obtain  ID  of  the  remarketing  code.   To  do  this  we  have  to  visit  our  AdWords  account  and  a  “Shared  library”  tab  then   “Audiences”.    There  are,  or  there  will  be,  our  remarketing  lists.     Let’s  move  to  an  option  of  displaying  the  details  of  the  remarketing  tag  and  from  there  we   have  to  obtain  the  ID  number  of  our  tag,  which  will  be  displayed  in  a  moment  in  GTM.              
  • 42.       42   We  come  back  to  Tag  Manager  and  place  ID  in  a  suitable  place.  Only  ID  is  necessary,  we  do   not  have  to  give  labels,  which  were  deleted  in  common  remarketing  code.  Only  if  we  create   new  codes  in  one  account,  there  will  be  need  of  distinguish  them  with  labels.       Labels  are  used  for  a  unique  labeling  conversion  codes  on  the  account.  Now  we  can  use  one   code  and  we  create  remarketing  lists  on  the  basis  of  this  code  and  rules  defining  when  the   list  is  to  collect  cookies.  That  can  be  done  directly  from  AdWords  account.           Now  we  have  to  only  create  a  rule  when  a  given  remarketing  code  will  be  called  to  collect   cookies  (i.e.  website  visitors).  We  almost  always  start  adventure  with  remarketing  from   building  the  list  of  cookies  of  everyone  who  visited  our  website.  Hence,  in  this  example  we   will  use  the  same  rule  like  in  the  case  of  Google  Analytics  (all  pages).  A  code  is  to  be  called   on  every  website  of  our  service.  That  means  that  the  remarketing  cookie  will  be  given  to   each  browser1,  who  will  visit  our  service,  no  matter  what  subpage  of  the  service  it  meets.                                                                                                                         1 Writing about users or people we have to consider that it is a mental shortcut because we really think
  • 43.       43       A  remarketing  code  can  be  fired  also  with  the  help  of  other  rules.  We  could,  for  example,   create  a  rule,  which  will  fire  the  remarketing  tag,  if  somebody  clicks  on  the  link  or  a  button.   We  can  create  rules,  which  will  fire  the  list  after  the  time  chosen  by  many  others  and  us.   While  reading  this  e-­‐book  we  will  get  to  know  how  to  create  such  rules.       While  we  now  fire  the  tag  on  every  website  of  our  website  we  can  then  create  remarketing   lists  directly  on  our  AdWords  account  based  on  fired  remarketing  tag  and  rules  set  on   AdWords  accounts  while  creating  new  remarketing  lists.       In  the  image  from  the  previous  website,  we  can  see  also  something  which  is  marked  as   "Customs  parameters”.  These  parameters  are  used  for  creating  more  advanced  conditions   of  firing  tags.  We  can,  for  example,  download  data  from  the  website  about  values  of  a   customer’s  basket  and  depending  on  its  value  fire  the  remarketing  tag  or  (add  to  the  list  or   not).  We  use  these  parameters  in  creating  a  campaign  of  dynamic  remarketing.  In  this  place   our  adventure  with  something,  which  is  called  Data  Layer,  starts.     Data  Layer  is  probably  the  most  important  functionality  of  Google  Tag  Manager  because  it   makes  data  on  the  website  dependent  on  the  website  code  itself  and  makes  that  data  from   the  website  become  available  for  many  our  tools  which  we  have  on  the  website.  We  can   compare  Data  Layer  to  a  universal  plug-­‐in,  which  we  can  buy  at  the  airport,  to  which  from   one  side  we  can  connect  a  laptop  and  from  the  other  we  can  plug  any  socket  all  over  the  
  • 44.       44   world.     In  the  same  way  data  from  our  website,  thanks  to  such  a  universal  plugin,  can  be   comprehensible  for  many  tools  and  there  is  no  need  to  connect  them  separately  to  the   website.  We  will  talk  about  Data  Layer  in  details  later  in  this  e-­‐book,  so  do  not  worry  that   now  it  can  be  a  little  unclear.     Important!  At  this  moment  we  can  create  remarketing  lists  within  Google  Analytics,  which  I   encourage  to.  Thanks  to  GA  we  can  create  lists  based  on  many  actions  of  users  of  our   website.  We  do  not  have  to  use  an  AdWords  remarketing  code  then.  We  create  remarketing   lists  in  the  Analytics  interface  itself.  (Until  now  remarketing  is  not  serviced  by  Universal   Analytics).        
  • 45.       45   Google Tag Manager – advanced cases of use   On  previous  pages  we  have  discussed  the  most  frequent  and  basic  methods  of  using  GTM  in   work  with  tags  on  our  website.  We  have  installed  a  basic  Google  Analytics  code,  AdWords   conversion  tracking  and  a  remarketing  code.  Most  installations  end  here.  However,  times   are  different  now,  so  we  need  more  and  more  data  to  collect  and  process  from  our  website,   we  need  to  understand  more  and  more  precisely  what  visitors  of  our  website  really  need,   we  need  to  better  aim  our  marketing  campaigns,  etc.  That  is  why,  surely,  there  is  a  need  of   additional  operations  on  data  which  are  on  our  website,  we  will  want  to  examine  every   area  of  the  website,  we  will  want  to  mark  every  visitor  in  a  better  way.         So,  there  will  be  some  play  at  more  advanced  implementation  and  use  of  GTM  possibilities.   In  this  part  there  are  the  most  useful  and  popular  advanced  configurations  of  tags  and   macros,  so  that  we  could  measure  everything  on  the  website  and  run  effective  marketing   campaigns.  The  examples  below  will  help  us  understand  better  the  work  of  Google  Tag   Manager  tool.      It  will  allow  us  to  move  easily  in  it  and  configure  any  tags.     Data Layer – what is it and what is it used for?   Before  we  move  to  advanced  implementations,  which  I  will  try  to  describe  step  by  step,  it  is   important  for  us  to  understand  one  of  the  most  important  functionality  of  GTM  that  is  Data   Layer.   What is Data Layer?   Data  Layer  is  a  combination  of  structured  API  Data  and  interfaces,  which  allow  making  use   of  a  universal  format  (JSON)  of  tagging  services  and  sending  data  to  the  management   system  (GTM).  In  this  way,  data  are  available  for  many  tools  with  no  need  to  tag  the   website  each  time  by  separate  formats  for  every  tool  which  we  want  to  connect.  Not  clear?  
  • 46.       46   Neither  to  me;)  So  in  simpler  words.     Having  many  marketing  systems  to  connect  to  our  website  we  have  to  add  for  each  time  a   special  code  (plugin)  for  every  tool  separately.  Each  tool  usually  works  in  a  different  way.     If  we  have  many  things  to  measure  (buttons,  purchase  systems,  basket,  etc.)  and  a  lot  of   tools,  there  can  be  quite  a  big  mess  on  our  website.  An  employee,  who  dealt  with  it,    quits   his  job  and  we  want  to  change  something  and  we  have  a  big  problem.  A  remedy  for  such  a   situation  is  just  Data  Layer  which  has  been  compared  before  to  the  universal  plugin  which   we  can  apply  in  every  country.        
  • 47.       47   Data  Layer  is  a  kind  of  "translator”  like  English  for  different  kind  of  tools,  as  far  as  data  on   our  website  are  concerned.  Everyone  loves  their  mother  tongue  but  not  everywhere  in  the   world  we  can  communicate  in  it  and  we  need  a  universal  language.  In  our  world,  if  we  want   or  not,  it  is  English.  In  the  world  of  data  it  is  Data  Layer.     Thanks  to  this  information  from  the  website  such  as  events  (e.g.  button  clicks)  or  values   can  be  sent  to  Google  Tag  Manager  just  by  Data  Layer.  After  that  in  the  GTM  tool  itself  we   create  rules  on  the  basis  of  these  values.  For  example  “Call  a  remarketing  code  (tag)  when   the  value  of  a  basket  is  higher  than  300  USD  (variable=basket,  value=300).  Rules  can  be  in   this  case  created  for  each  tool  which  is  connected  on  our  website.  That  is  the  secret  of  Data   Layer.     Data  Layer  fulfills  also  other  roles.  It  allows  to  separate  data  from  the  layer  of  the  website   code  (html,  css).  As  we  separated  the  style  layer  before  (how  the  website  looks  like)  thanks   to  CSS  language,  now  we  separate  data  from  the  layer  of  the  website  code  itself.  While   modifying  something  on  any  layer  we  do  not  violate  the  structure  of  the  rest.  It  gives   security  and  order  in  administering  of  our  services.      
  • 48.       48   How  does  Data  Layer  look  like?     Data  Layer  is  built  into  the  container  code,  if  we  want  to  send  information  from  the  website   (e.g.  events  like  clicks)  you  have  to  only  send  them  to  Data  Layer  with  the  help  of  push   method.  For  example,  if  we  want  to  send  information  to  Data  Layer  that  somebody  has   clicked  the  button  we  place  the  following  code  fragment  in  the  website  code:     <a  href="#"  onclick="dataLayer.push({'event':  'sample-­‐link'});">Sample  link</a>     If  someone  has  something  in  common  with  Javascript  language  they  know  that  the  push   method  simply  adds  data  to  the  array.  And  this  just  happens.  For  those  who  are  not  familiar   with  issues  of  programming,  information  that  method  works  the  same  like  in  the  case  of   labeling  events  in  Google  Analytics  is  enough.     In  this  example,  at  the  onclick  moment  the  information  to  Data  Layer  that  the  event   happened  with  the  value  ‘sample-­‐link’  is  sent.         In  this  way  this  information  can  be  used  by  any  tag  which  is  installed  on  the  website  by   GTM.  For  example,  we  can  “order”  Google  Analytics  to  register  onclick  events,  we  can   “order”  remarketing  tag  to  mark  the  user  who  has  clicked  on  the  link  (to  add  them  to  the   list  of  users  who  have  clicked  on  the  link)  or  we  can  register  the  conversion  in  AdWords   with  the  help  of  tag  of  AdWords  conversion  tracking.     One  event  label  which  was  sent  to  Data  Layer  and  many  possibilities  of  being  used  by  many   tools.  This  is  the  power  of  Data  Layer.    
  • 49.       49   Adding variables and values to Data Layer   In  the  previous  paragraph  we  have  added  one  variable  (event)  and  one  value  (sample-­‐link)   to  Data  Layer2  .  Such  adding  data  to  Data  Layer  will  take  place  only  just  when  the  website  is   loaded  and  the  user  clicks  on  the  marked  link.       However,  we  can  send  data  earlier  during  loading  the  website.  In  this  way  tags  which  will   be  loading,  while  loading  the  website,  will  be  able  to  use  data  sent  to  Data  Layer.  We  have   to  send  such  data  at  the  moment  of  downloading  the  website.  We  do  this  by  a  simple  array   (again  the  element  very  well-­‐known  to  people  who  know  Javascript).  The  empty  table  looks   like  this:           The  essential  fact  is  that  the  array  of  Data  Layer  is  above  the  container  script.  It  is  very   important.  Now  we  will  add  pairs  of  information  (variable  and  value)  inside  this  array.  We   will  explain  how  it  looks  like  in  a  moment.     A  good  example  is  information  if  the  user  who  has  entered  the  website  is  logged  in  or  not.   If,  for  example,  the  user  is  not  logged  in  we  add  him  to  the  remarketing  list  of  people  who                                                                                                                   2  Of  course  we  can  send  such  pairs  variable  :  value  as  many  as  we  want  for  one  event.  More  in  Google  Tag   Manager  help.    
  • 50.       50   have  not  been  registered  yet.  If  we  have  such  a  case,  it  is  important  so  that  data  get  to  GTM   as  soon  as  possible.     In  this  situation  we  have  to  send  information  while  loading  an  individual  subpage.  That  is   why  we  send  information  about  the  kind  of  user  to  Data  Layer.         In  this  example  we  added  two  pieces  of  information.   variable:  “visitor-­‐type”  of  value  –  “unregistered”  and  variable:  “category”  of  value  –   “signup”.     Except  information  about  the  kind  of  a  user,  we  have  send  at  once  information  about  the   kind  of  the  subpage  (category)  which  the  user  is  on.  The  unregistered  user  found  himself   on  the  “signup”  subpage.  The  website  category  may  be  helpful  e.g.  in  a  dynamic   remarketing.     Thanks  to  the  fact  that  data  were  immediately  in  Data  Layer,  tags  which  are  loaded  on  the   website  can  make  use  of  these  data  at  once  with  no  need  of  any  visitor's  action  on  the   website.       We  can  send  any  amount  of  data  to  Data  Layer.  There  is  one  question  which  can  occur  -­‐  
  • 51.       51   Where  are  these  data  to  get  from?  Unfortunately,  in  this  particular  situation,  our  website   will  often  require  interventions  of  somebody  who  will  be  able  to  send  data   programmatically  to  Data  Layer  e.g.  from  our  shop  or  registration  system  (data  from  a  data   base,  server).  If  somebody  has  used  the  ecommerce  Google  Analytics  module  on  their   website,  the  matter  of  sending  variable  values  to  Data  Layer  is  analogical.  Simply  speaking   (not  programmatically):  in  Data  Layer  there  must  be  values  from  our  shop,  from  a  sales   module,  etc,  which  will  be  recorded  clearly  for  GTM  (read:  variable  –  value).  It  can  be  e.g.  a   basket  value  which  will  be  sent  to  Data  Layer  from  our  shop,  thanks  to  which  GTM  (and   other  tags  installed  there)  will  be  able  to  use  this  value  e.g.  to  create  conditions  of  firing   tags.     NOTICE:  Data  Layer  is  not  required  in  any  way.  Without  Data  Layer,  GTM  will  also  fulfill  its   role  of  “tag  storage  and  management”.  However,  lack  of  Data  Layer  limits  a  lot  possibilities   which  GTM  gives  to  us.     After  this  short  comment  about  what  Data  Layer  consists  in  we  can  go  to  more  advanced   examples  of  using  GTM  in  work  with  measuring  our  activity  in  the  Internet.     If  we  want  to  see  what  was  loaded  to  Data  Layer  we  can  easily  check  it  with  the  help  of  the   console  for  programmers  for  example  in  Chrome  browser.  We  enter  the  menu  View  -­‐>   Developer  -­‐>  Javascript  console.