Updated: 09/12/2022

Published: 09/09/2022

By Peter K

Setup GA4

For WordPress with Woo-commerce installed

  1. Install GTM4WP
  2. Setup a Google Analytics and get a measurement ID, starts with G- 
  3. Setup a G Tag Manager Account and follow this guide.
  4. If you publish the tag, and you get an error: Unknown variable “Event” found in a tag.
    • You will need to enable the Event system variable first. It can be done by visiting the “Variables” page, select “Configure” in the “Built-In Variables” panel and check the box next to the “Event” variable.
  5. In GTM4WP you will need to have the following settings
    1. Google Tag Manager ID: starting with GTM-
    2. Container code ON/OFF: Turned to On
    3. Container code compatibility mode: Manually coded (needs tweak in your template)

That should be all the settings for GA4.

Default WordPress Sitemap location

For WordPress no SEO plugins installed

  • EG
    • https://example.com/wp-sitemap.xml

However I do not recommend that you submit this to google console but you submit the relevant inner sitemaps instead EG

  • For Pages
    • https://example.com/wp-sitemap-posts-page-1.xml 
  • For posts
    • https://example.com/wp-sitemap-posts-post-1.xml
  • For products
    • https://example.com/wp-sitemap-posts-product-1.xml
  • Otherwise it will also add
    • https://example.com/wp-sitemap-taxonomies-category-1.xml
    • https://example.com/wp-sitemap-taxonomies-product_cat-1.xml
    • https://example.com/wp-sitemap-users-1.xml

Those additional sitemaps will probably not be needed for google search console.

Which will probably submit duplicate content.