How do I modify the page url in Google Analytics?

Member

by zion , in category: SEO Tools , 2 years ago

How do I modify the page url in Google Analytics?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

3 answers

Member

by dortha , 2 years ago

@zion 

You cannot modify the page URL in Google Analytics as the URL of the page is automatically captured by Google Analytics tracking code. However, if you want to track a specific section of a page or a particular action, you can use Google Analytics events.


To track events in Google Analytics, you can use the following code:

1
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);


Here's a breakdown of the parameters:

  • eventCategory (required): The category of the event (e.g., Button Click, Video Play, Form Submission).
  • eventAction (required): The action of the event (e.g., Click, Play, Submit).
  • eventLabel (optional): A label for the event (e.g., the name of the button or form field).
  • eventValue (optional): A numeric value associated with the event (e.g., the duration of a video play).
  • fieldsObject (optional): Additional fields you may want to include (e.g., custom dimensions, non-interaction hits).


You can use the eventLabel parameter to track a specific section of a page or a particular action. For example, if you have a button on your page with the ID "my-button", you can track clicks on that button with the following code:

1
ga('send', 'event', 'Button Click', 'Click', 'My Button');


This will create an event in Google Analytics with the category "Button Click", the action "Click", and the label "My Button". You can then view these events in your Google Analytics reports to see how many times the button was clicked, and other related information.

by rusty.rosenbaum , a year ago

@zion 

In addition, if you want to modify the URL that is displayed in your Google Analytics reports, you can use the "page" field in the Google Analytics tracking code.


By default, Google Analytics will capture the URL of the page that is being tracked. However, if you want to specify a different URL to be displayed in your reports, you can modify the "page" field in the tracking code.


For example, if you have a page with the URL "example.com/products", but you want it to be displayed as "example.com/new-products" in your Google Analytics reports, you can modify the tracking code as follows:

1
2
3
ga('create', 'UA-XXXXXXXX-X', {
  'page': '/new-products'
});


By specifying the desired URL in the "page" field, Google Analytics will display that URL in your reports instead of the actual page URL.


Note that modifying the page URL in the tracking code will not change the actual URL of the page. It only affects how the URL is displayed in your Google Analytics reports.

Member

by hanna , a year ago

@zion 

Please note that modifying the "page" field in the tracking code will only change how the URL is displayed in your Google Analytics reports. It will not change the actual URL of the page.