[GA4] Collect user-provided data (gtag.js)

This feature is part of an open beta. Keep in mind that the feature is subject to change.

These instructions are for administrators and editors who have activated user-provided data collection and want to start sending user-provided data from a website using gtag.js.

Before you begin

You must turn on user-provided data collection in Google Analytics.

Choose how to identify user-provided data

  1. In Admin, under Data collection and modification, click Data streams.
    Note: The previous link opens to the last Analytics property you accessed. You can change the property using the property selector. You must be an Editor or above at the property level to configure your user-provided data settings.
  2. Select the desired web data stream.
  3. Under Google tag, click Configure tag settings > Allow user-provided data capabilities.
  4. Enable Allow user-provided data capabilities.
  5. Choose one or more ways to identify user-provided data:
     
    Option Description
    Automatically detect user-provided data Google Analytics inspects your web pages for strings that match the pattern for an email address. Phone numbers and addresses are excluded from the option. We recommend supplementing the option with the following options.
    Specify CSS selectors or JavaScript variables

    Select the types of user-provided data you want to collect, such as email addresses or phone numbers. For each type of data, select how you want to identify the data on the page — either a CSS selector or global JavaScript variable. Learn more about this option

    This method is more precise than automatically detecting user-provided data, but not as reliable as adding a code snippet to your website. If you frequently change your website code, in particular the formatting or CSS selectors on the collection page, you may want to consider adding a code snippet to your website.

    Add a code snippet to your website Add JavaScript code to your web pages to collect email addresses, phone numbers, and/or names and addresses. Then, set the user_data parameter for each event on the page. Learn more about this option
     
  6. Click Save.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
8086057966116792021
true
Search Help Center
true
true
true
true
true
69256
true
false