How do I use the Google Analytics Module for Drupal SEO?

https://www.drupal.org/project/google_analytics

About the Google Analytics Module The Google Analytics module adds the Google Analytics code snippet to your website and allows you to control how and when it is used. Google Analytics is a valuable tool for any web marketer. It allows you to find valuable insights about your visitors including demographics, behavior on your site, where they found you online, what keywords they used to find you, and more. However, Google Analytics isn’t perfect. For example, it tracks all visitors by default— even Admins. The Google Analytics module can be configured to show the Google

Analytics code snippet only when a non-admin is visiting the site. This keeps your data clean and your reports more useful.

Install and Enable the Google Analytics Module

  1. Install the Google Analytics module on your server.
  2. Go to the Extend page: Click Manage > Extend (Coffee: “extend”) 
  3. Select the checkbox next to “Google Analytics” and click the Install button at the bottom of the page.

Configure the Google Analytics module First, you’ll create a Google Analytics property for your website. Then, you’ll add the tracking code to the Google Analytics module in Drupal 8.

  1. Sign in to Google Analytics at https://www.google.com/analytics/. Use your existing Google ID or the one you created earlier in this chapter.
  2. Create a Google Analytics property for your website.
  3. First-time Google Analytics users will need to Sign up, agree to the terms of service, and create an account. As part of the process, you’ll create your first Google Analytics property.
  4. If you already have a Google Analytics account, click the Admin link. From the left-hand ACCOUNT column, click the Accounts drop-down menu and select Create a new account.
  5. Fill out the New Account form and click the Get Tracking ID button at the bottom of the page.
  6. The tracking ID for your website will be on the next page. Copy it.
  7. On your Drupal 8 site, click Manage > Configuration > System > Google Analytics (Coffee: “google”) or visit http://yourDrupal8site.dev/admin/config/system/google- analytics in your browser.
  8. Under General Settings > Web Property ID, paste in the Google Analytics Tracking ID copied from the Google Analytics website.
  9. Click the Roles tab and select the Anonymous user checkbox. You may want to track more roles depending on your website configuration.
  10. The rest of the Google Analytics module settings should be left on default for most sites.
  11. Click the Save configuration button at the bottom of the page.

Verify the Google Analytics installation

  1. Open an incognito window in your browser. Go to your website’s homepage and view the source.
  2. Look for your Google Analytics Tracking ID number to verify that the Google Analytics code is installed on your website.
  3. Open your website in an Incognito window. Click around on your site to generate some test traffic.
  4. Now, log in to Google Analytics and go to your property.
  5. Click Admin > Property > .js Tracking Info > Tracking Code.
  6. At the top, under “Status”, you should see “Receiving traffic…”.