Skip to content

Add Google Tag/AdSense Code to WordPress

Adding a Google Tag or AdSense code to your WordPress site is a straightforward process. Follow these steps to ensure the code is correctly integrated into your website.

Last updated


Adding a Google Tag or AdSense code to your WordPress site is a straightforward process. Follow these steps to ensure the code is correctly integrated into your website.

Step 1: Sign in to your WordPress backend

  1. Go to your WordPress login page.
  2. Enter your credentials and sign in to access the WordPress dashboard.

Step 2: Access the theme file editor

  1. In the menu on the left, click Appearance.
  2. From the dropdown menu, select Theme File Editor.
Theme File Editor with Appearance menu
Theme File Editor with Appearance menu

Step 3: Locate the header file

  • In the right-hand panel of the Theme File Editor, look for the Theme Header (header.php) file.
  • Note: The file name can differ depending on your theme. For example, if you're using the "WordPress Twenty Twenty-One" theme, the header file is named header.php.
  • Open the header file and confirm that it contains a <head> tag.

Step 4: Add the Google Tag/AdSense code

  1. Copy the Google Tag/AdSense code snippet from your Google account.
  2. Paste the code snippet within the <head> tag in the header file.
  3. Click Update File to save your changes.
Add code within the head tag in header.php
Add code within the head tag in header.php

By following these steps, you can successfully integrate Google Tag or AdSense code into your WordPress site.