2
0

add_tracking_scripts.rst 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. Add Tracking Scripts
  2. ====================
  3. Tracking scripts, such as like Google Analytics or Facebook Pixels, can be added
  4. to the ``<head>`` and ``<body>`` of all of your web pages.
  5. Tracking settings are located in the Wagtail Admin dashboard under
  6. **Settings > Tracking**.
  7. .. warning::
  8. While it may be tempting to add dozens of tracking scripts to your website,
  9. keep in mind that **each script you add will slow your site down**
  10. and will invade your visitors' privacy. Therefore we recommend to carefully
  11. evaluate and choose one tracking solution that best fits your needs.
  12. Google Analytics
  13. ----------------
  14. There are two types of Google Analytics accounts --- "Universal Analytics"
  15. (generally for accounts created before 2021) and "Google Analytics 4":
  16. * **Universal Analytics** account IDs begin with **UA-**
  17. * **Google Analytics 4 (GA4)** account IDs begin with **G-**
  18. * If you are using both account types, you can enter both IDs and the data will
  19. populate both accounts. However, neither is "better" and using both does not
  20. provide any benefit compared to using just one.
  21. .. note::
  22. A common misconception is that Google Analytics helps boost SEO. This is not
  23. true! Google Analytics tracks people who use your site so you can see
  24. metrics such as: how many people viewed which pages, for how long, from what
  25. location, etc. It does not provide any benefit other than giving you this
  26. information.
  27. Google Tag Manager (GTM)
  28. ------------------------
  29. Google Tag Manager (GTM) is a separate product from Google Analytics. GTM lets
  30. you add **one** script to your site. Then, from the GTM Console, you can add
  31. multiple other tracking scripts (Such as Google Analytics, Google Adwords,
  32. Google Remarketing, Facebook Pixels, Salesforce, Pardot, StatCounter, Adobe,
  33. etc.). GTM makes it convenient for your marketing staff to continually add and
  34. change the tracking tools without having to make any changes to the website.
  35. If you are using Google Tag Manager, we recommend that you remove any other
  36. tracking scripts from your site, and add them instead through the GTM Console.
  37. Other Scripts
  38. -------------
  39. If you have other tracking codes to add, follow these steps:
  40. #. In the Wagtail admin, go to **Settings > Tracking**.
  41. #. The tracking scripts will usually give you instructions of where to place
  42. them. So, make sure to verify the instructions that were given to you.
  43. #. Copy and paste scripts that should be between the ``<head>`` tags in the box
  44. labeled for ``<head>`` scripts.
  45. #. Copy and paste scripts that should be toward the closing ``<body>`` tag in
  46. the box labeled for ``<body>`` scripts.
  47. #. Click **Save** and you're done!
  48. .. figure:: img/head-body-scripts-widgets.png
  49. :alt: The TRACKING dashboard.
  50. The tracking dashboard.
  51. .. note::
  52. You can verify that the scripts on the web page by going to the site and
  53. inspecting the Source Code. Then search for the ``<script>`` tags, either
  54. visually or by hitting ``CTRL + F`` on your keyboard and searching for the
  55. code. Here's how to get the Source Code if you are not sure:
  56. * Firefox: https://developer.mozilla.org/en-US/docs/Tools/View_source
  57. * Chrome: https://support.google.com/surveys/answer/6172725?hl=en
  58. * IE/Edge: https://docs.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/resources/