siri
siri

Reputation: 71

Add hostname to Google Analytics GA4

This is my current code:

function pageViewGa(pagePath, pageUrl, host) {
    gtag("event", "page_view", {
        "page_title": pagePath,
        "page_location": pageUrl,
        "page_path": pagePath
    });
}

I send pageViewGa() on each page with the variables appended. Can I know how I can have the hostname shown in Google Analytics too?

enter image description here

Upvotes: 5

Views: 1221

Answers (1)

DavidTaubmann
DavidTaubmann

Reputation: 3360

This website explains many methods of how to show the Hostname in Google Analytics 4 (GA4) without modifying anything in the script:

https://www.vakulski-group.com/blog/post/how-to-use-a-hostname-filter-in-ga4/

Basically this are the methods mentioned:

  1. Search for the Word "Hostname" and click on the first result;
  2. Create a new Exploration including the "Hostname" Dimension and “Event count” Metrics;
  3. You can also apply a filter for certain "Hostname" on your Exploration Reports.

Upvotes: 0

Related Questions