Add google website tracking tags(Google Analytics) in WordPress5.2 manually

First: find you tracking code in google Analytics

  1. goto Admin panel
  2. click “Tracnking info” under “Properly” block
  3. click “Tracking Info” and “Tracking Code”
  4. you will see you “Global Site Tag” on the right side.
  5. copy the html script !

Second: login you webserver and edit the php file

  1. cd into wordpress folder(wordpress/wp-content/themes/twentysixteen)
  2. vim header.php
  3. paste the First step code into <head>[put here]</head>
  4. save the file

Finally: visit you wordpress again the google analytics will work!

But you must edit each theme,if you change you theme.Edit the
wordpress/wp-content/themes/[twentysixteen,twentynineteen,twentyseventeen ]/header.php

I will try a more easy way to add google Analytics !