# Google Analytics Destination Config Reference

<p><a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/" >Google Analytics</a> (Universal Analytics) is a web analytics destination. RudderStack sends events to Google Analytics&rsquo; Measurement Protocol from its servers, or — for web sources — loads Google&rsquo;s <code>analytics.js</code> library in device mode.</p>
<p>In a Google Analytics destination spec:</p>
<ul>
<li><code>type: ga</code></li>
<li><code>definition_version: 1</code></li>
</ul>

<blockquote class="warning">
  <div class="tip-quote">
    
    <div class="tip-text"><p><strong>RudderStack has deprecated the Google Analytics destination.</strong></p>
<p>To send events to Google Analytics 4, use the <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/google-analytics-4/" >Google Analytics 4</a> destination type, <code>ga4</code>, instead.</p>
</div>
  </div>
</blockquote>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="sample-configuration">Sample configuration</h2><div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: destination
metadata:
  name: google-analytics-prod
spec:
  id: google-analytics-prod
  display_name: Google Analytics Production
  type: ga
  definition_version: 1
  enabled: true
  config:
    tracking_id: &#34;{{ .GA_TRACKING_ID }}&#34;
    send_user_id: true
    anonymize_ip: true
    enhanced_ecommerce: true

    dimensions:
      - from: plan
        to: dimension1
    metrics:
      - from: age
        to: metric1
    content_groupings:
      - from: section
        to: contentGroup1

    enable_server_side_identify: true
    server_side_identify:
      event_category: user_type
      event_action: User Enriched

    track_categorized_pages:
      web: true
    track_named_pages:
      web: true
    sample_rate:
      web: &#34;100&#34;
    site_speed_sample_rate:
      web: &#34;1&#34;

    event_filtering:
      blacklist:
        - Cart Viewed

    connection_mode:
      web: device
      cloud: cloud
    consent_management:
      web:
        - provider: oneTrust
          consents:
            - analytics</code></pre></div>
</div>
<p>The above example loads <code>analytics.js</code> on web sources in <code>device</code> mode, where the <code>web</code>-keyed settings apply, and sends server-side events in <code>cloud</code> mode, where <code>enable_server_side_identify</code> lets <code>identify</code> calls through — see <a href="#web-device-mode" >Web device mode</a> and <a href="#cloud-mode" >Cloud mode</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="config-keys">Config keys</h2><p><code>config</code> accepts only the keys listed below. The <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#config-key-rules" >shared config key rules</a> cover unknown keys, defaults, and immutability.</p>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text"><p>Google Analytics settings split by connection mode. The groups below say which mode each key affects. Rudder CLI accepts every key whatever the mode — a key for the other mode is stored and ignored.</p>
<p>In <code>cloud</code> mode Google Analytics accepts <code>identify</code>, <code>page</code>, <code>screen</code>, and <code>track</code>. In <code>device</code> mode, web sources send <code>page</code> and <code>track</code>; an <code>identify</code> call sets the user ID and mapped traits on the tracker for later hits, without sending a hit of its own.</p>
</div>
  </div>
</blockquote>

</html>
<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="connection">Connection</h3><div class="rs-ckeys">
<div class="rs-ckey" id="tracking_id">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">tracking_id</p>RequiredSecret</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Tracking ID of your Universal Analytics property, from <strong>Admin</strong> &gt; <strong>Tracking Info</strong> &gt; <strong>Tracking Code</strong> in Google Analytics.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>UA-</code>, <code>YT-</code>, or <code>MO-</code>, then digits, a hyphen, and up to 100 more digits — for example <code>UA-123456789-1</code>.</li>
<li>A Google Analytics 4 measurement ID (<code>G-…</code>) is rejected. GA4 properties take the <code>ga4</code> type.</li>
<li>A <code>{{ path || fallback }}</code> template is accepted in place of a literal.</li>
<li>A spec that omits this key fails validation with <code>'tracking_id' is required</code>.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <p>Supply it as a <code>{{ .VAR }}</code> reference rather than a literal — see <a href="#secrets" >Secrets</a>.</p>
<p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/#where-can-i-find-the-google-analytics-tracking-id" >Where can I find the Google Analytics tracking ID?</a>.</p>

</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="tracking">Tracking</h3><p>These keys apply in both modes.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="send_user_id">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">send_user_id</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Send the event&rsquo;s <code>userId</code> to Google Analytics as the user ID, for identified visitors. The dashboard calls it <strong>Send user-id to GA</strong>.
</p>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/#identify" >Identify</a>.
</div>

</div>

<div class="rs-ckey" id="anonymize_ip">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">anonymize_ip</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Anonymize visitors&rsquo; IP addresses.
</p>

</div>

<div class="rs-ckey" id="include_search">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">include_search</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Include the query string in the page path sent with page views. The dashboard calls it <strong>Include the Querystring in Page Views</strong>.
</p>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/#site-search" >Site search</a>.
</div>

</div>

<div class="rs-ckey" id="non_interaction">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">non_interaction</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Mark every event as a non-interaction hit, which doesn&rsquo;t count toward bounce rate. An event&rsquo;s own <code>properties.nonInteraction</code> overrides it.
</p>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/#non-interaction-events" >Non-interaction events</a>.
</div>

</div>

<div class="rs-ckey" id="enhanced_ecommerce">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">enhanced_ecommerce</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Send ecommerce events through Google Analytics enhanced ecommerce. It must be turned on in Google Analytics too.
</p>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/#enhanced-ecommerce" >Enhanced ecommerce</a>.
</div>

</div>

<div class="rs-ckey" id="enhanced_link_attribution">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">enhanced_link_attribution</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Turn on Google Analytics enhanced link attribution, for more detailed reports of the links visitors click. In <code>cloud</code> mode, the link ID comes from the event&rsquo;s <code>properties.linkid</code>.
</p>

</div>

<div class="rs-ckey" id="double_click">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">double_click</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Turn on Google&rsquo;s advertising features — remarketing, display ads, and demographic reports. The dashboard calls it <strong>Remarketing, Display Ads and Demographic Reports</strong>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>In web <code>device</code> mode, it loads Google&rsquo;s display features plugin.</li>
<li>In <code>cloud</code> mode, RudderStack instead marks each hit with the Measurement Protocol&rsquo;s <code>npa=1</code>, which disables ads personalization for that hit.</li>
</ul>

</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="custom-dimensions-and-content-groupings">Custom dimensions and content groupings</h3><p>These keys apply in both modes. In each mapping, <code>from</code> and <code>to</code> are each at most 100 characters, or a <code>{{ path || fallback }}</code> template.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="dimensions">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">dimensions</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps event properties and traits to Google Analytics custom dimensions, which must exist in Google Analytics first.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>from</code> — event property or trait name.</li>
<li><code>to</code> — custom dimension, written <code>dimension&lt;index&gt;</code>, such as <code>dimension1</code>.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">dimensions:
  - from: plan
    to: dimension1</code></pre></div>
</div>
<p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/#custom-dimensions" >Custom dimensions</a>.</p>
</div>

</div>

<div class="rs-ckey" id="metrics">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">metrics</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps numeric event properties and traits to custom metrics.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>from</code> — event property or trait name.</li>
<li><code>to</code> — custom metric, written <code>metric&lt;index&gt;</code>, such as <code>metric1</code>.</li>
</ul>

</div>

</div>

<div class="rs-ckey" id="content_groupings">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">content_groupings</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps event properties and traits to content groupings, which group pages together in reports.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>from</code> — event property or trait name.</li>
<li><code>to</code> — content grouping, written <code>contentGroup&lt;index&gt;</code>, such as <code>contentGroup1</code>.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/#content-groupings" >Content groupings</a>.
</div>

</div>

<div class="rs-ckey" id="custom_mappings">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">custom_mappings</p>Internal</div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  An older, combined form of <code>dimensions</code> and <code>metrics</code>. Cloud mode reads it only when neither <code>dimensions</code> nor <code>metrics</code> is set.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>from</code> — event property or trait name.</li>
<li><code>to</code> — an entry whose <code>to</code> starts with <code>cd</code> is a custom dimension, and one starting with <code>cm</code> is a custom metric.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  The dashboard keeps this field hidden. Rudder CLI accepts it so that a destination already carrying values keeps them. Leave it out of a new destination, and keep whatever <code>rudder-cli import</code> brings back.
</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="cloud-mode">Cloud mode</h3><p>These keys apply to events sent in <code>cloud</code> mode.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="enable_server_side_identify">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">enable_server_side_identify</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Send <code>identify</code> calls to Google Analytics as events. When <code>false</code>, <code>identify</code> events sent in <code>cloud</code> mode fail with an error.
</p>

</div>

<div class="rs-ckey" id="server_side_identify">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">server_side_identify</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Event category and action for the events <code>identify</code> calls become.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Applies when <code>enable_server_side_identify</code> is <code>true</code>. Leave it unset otherwise.</li>
<li><code>event_category</code> — name of the <code>identify</code> trait whose value RudderStack sends as the event category. When the event has no such trait, the category is <code>All</code>.</li>
<li><code>event_action</code> — event action.</li>
<li>Set both or neither — Rudder CLI rejects one without the other. Omit the block to send the category <code>All</code> and the action <code>User Enriched</code>.</li>
<li>Each is at most 100 characters, or a <code>{{ path || fallback }}</code> template.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">server_side_identify:
  event_category: user_type
  event_action: User Enriched</code></pre></div>
</div>
<blockquote class="warning">
  <div class="tip-quote">
    
    <div class="tip-text">Despite its name, and the dashboard&rsquo;s <strong>Server Side Identify Event Category</strong> label, <code>event_category</code> isn&rsquo;t the category itself. RudderStack sends the value of the trait it names — <code>event_category: user_type</code> sends each user&rsquo;s <code>user_type</code> trait.</div>
  </div>
</blockquote>

</div>

</div>

<div class="rs-ckey" id="disable_md5">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">disable_md5</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Don&rsquo;t fall back to an MD5 hash of <code>userId</code> for the client ID. The dashboard calls it <strong>Disable Md5 encryption from Client ID</strong>.
</p>

<div class="rs-ckey__extra">
  RudderStack takes the client ID from the <code>integrations</code> object, the <code>gaExternalId</code> external ID, <code>traits.cid</code>, or <code>anonymousId</code>, in that order. When none is set, it hashes <code>userId</code>, unless this is <code>true</code>. See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/#how-rudderstack-takes-clientid" >How RudderStack takes <code>clientId</code></a>.
</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="user-deletion">User deletion</h3><div class="rs-ckeys">
<div class="rs-ckey" id="rudder_delete_account_id">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">rudder_delete_account_id</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  ID of the Google account RudderStack uses to delete users from Google Analytics, for example on a suppress-with-delete regulation. The dashboard calls it <strong>Data regulation account</strong>, and creates the account when you sign in with Google.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Applies whatever the connection mode — deletion runs from RudderStack&rsquo;s servers.</li>
<li>At most 100 characters, and must not contain line breaks.</li>
<li>A <code>{{ path || fallback }}</code> template is accepted in place of a literal.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  User deletion is available only on the Enterprise plan. See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/#deleting-a-user" >Deleting a user</a>.
</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="web-device-mode">Web device mode</h3><p>These keys configure <code>analytics.js</code> in the browser, so they apply only when <code>connection_mode.web</code> is <code>device</code>. Each is an object keyed by <code>web</code>. Where the dashboard has a default, the SDK applies the same value when the key is unset.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="track_categorized_pages">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">track_categorized_pages</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Also send a non-interaction event for each <code>page</code> call that has a category.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>web</code> — boolean. Unset means <code>true</code>, the dashboard&rsquo;s default.</li>
</ul>

</div>

</div>

<div class="rs-ckey" id="track_named_pages">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">track_named_pages</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Also send a non-interaction event for each <code>page</code> call that has a name.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>web</code> — boolean. Unset means <code>true</code>.</li>
</ul>

</div>

</div>

<div class="rs-ckey" id="use_rich_event_names">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">use_rich_event_names</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Name the events that <code>track_categorized_pages</code> and <code>track_named_pages</code> send <code>Viewed &lt;category&gt; Page</code> and <code>Viewed &lt;name&gt; Page</code> — for example <code>Viewed Signup Page</code>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>web</code> — boolean.</li>
</ul>

</div>

</div>

<div class="rs-ckey" id="sample_rate">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">sample_rate</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Percentage of users to track.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>web</code> — a percentage written as a string: <code>&quot;50&quot;</code>, not <code>50</code>. Rudder CLI checks only that it&rsquo;s at most 100 characters, or a template. Unset means <code>&quot;100&quot;</code>.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">sample_rate:
  web: &#34;50&#34;</code></pre></div>
</div>

</div>

</div>

<div class="rs-ckey" id="site_speed_sample_rate">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">site_speed_sample_rate</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Percentage of users whose site speed data is collected.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>web</code> — a percentage written as a string, on the same terms as <code>sample_rate</code>. Unset means <code>&quot;1&quot;</code>.</li>
</ul>

</div>

</div>

<div class="rs-ckey" id="domain">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">domain</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Domain the <code>_ga</code> cookie is set on. The dashboard calls it <strong>Cookie Domain Name</strong>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>web</code> — string, at most 100 characters, or a template. Unset means <code>auto</code>.</li>
</ul>

</div>

</div>

<div class="rs-ckey" id="optimize">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">optimize</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Google Optimize container ID. With it set, the SDK loads the Optimize plugin.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>web</code> — string, at most 100 characters, or a template. <strong>Secret</strong> — see <a href="#secrets" >Secrets</a>.</li>
</ul>

</div>

</div>

<div class="rs-ckey" id="set_all_mapped_props">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">set_all_mapped_props</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Set the mapped custom dimensions and metrics on the page, so every later event on that page carries them. When <code>false</code>, they&rsquo;re sent only with the event they came from. The dashboard calls it <strong>Set Custom Dimensions &amp; Metrics to the Page</strong>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>web</code> — boolean. Unset means <code>true</code>.</li>
</ul>

</div>

</div>

<div class="rs-ckey" id="reset_custom_dimensions_on_page">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">reset_custom_dimensions_on_page</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Properties whose custom dimensions are cleared on each <code>page</code> call, before new values are set. Each name must also appear as a <code>from</code> in <code>dimensions</code>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>web</code> — array of property names, each at most 100 characters or a template.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">reset_custom_dimensions_on_page:
  web:
    - plan</code></pre></div>
</div>

</div>

</div>

<div class="rs-ckey" id="named_tracker">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">named_tracker</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Send events through a tracker named <code>rudderGATracker</code> instead of the default tracker.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>web</code> — boolean.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/#named-tracker" >Named tracker</a>.
</div>

</div>

<div class="rs-ckey" id="use_google_amp_client_id">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">use_google_amp_client_id</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Use the AMP client ID, so users are recognized across AMP and non-AMP pages.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li><code>web</code> — boolean.</li>
</ul>

</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="event-filtering">Event filtering</h3>
<blockquote class="warning">
  <div class="tip-quote">
    
    <div class="tip-text"><a href="https://www.rudderstack.com/docs/sources/event-streams/sdks/event-filtering/" >Client-side event filtering</a> is applied by the RudderStack SDK, so it affects only web sources connected in <code>device</code> mode. Rudder CLI accepts the block in any mode, but events sent in <code>cloud</code> mode reach Google Analytics unfiltered.</div>
  </div>
</blockquote>
<div class="rs-ckeys">
<div class="rs-ckey" id="event_filtering">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">event_filtering</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Restricts which <code>track</code> events the SDK passes to Google Analytics, by event name.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Applies when <code>connection_mode.web</code> is <code>device</code>. Leave it unset otherwise.</li>
<li><code>whitelist</code> — array of event names to allow; every other <code>track</code> event is dropped.</li>
<li><code>blacklist</code> — array of event names to drop; every other <code>track</code> event is allowed.</li>
<li>The two are mutually exclusive, and Rudder CLI enforces it — setting both fails validation.</li>
<li>Each name is at most 100 characters, or a <code>{{ path || fallback }}</code> template.</li>
</ul>

</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="per-source-keys">Per-source keys</h3><p>Both keys are objects keyed by the local source type — the tokens listed under <a href="#source-types" >Source types</a>. A key naming a source type this destination doesn&rsquo;t support fails validation.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="connection_mode">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">connection_mode</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps each source type you connect to the mode its events reach Google Analytics in, using the modes in <a href="#source-types" >Source types</a>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>An entry is required for each source type you connect — see <a href="#connect-a-source" >Connect a source</a>.</li>
<li>A mode the source type doesn&rsquo;t support on this destination fails validation — for example <code>device</code> for <code>ios</code>.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">connection_mode:
  web: device
  cloud: cloud</code></pre></div>
</div>

</div>

</div>

<div class="rs-ckey" id="consent_management">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">consent_management</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Consent provider configuration per source type. The entry shape, accepted providers, and the rules on <code>resolution_strategy</code> and <code>consents</code> are shared across all destination types — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#consent-management" >Consent management</a>.
</p>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="source-types">Source types</h2><p>Google Analytics accepts events from these source types in the mentioned connection modes:</p>
<table>
  <thead>
      <tr>
          <th>Source type</th>
          <th>Connection mode</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>android</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>android_kotlin</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>ios</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>ios_swift</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>web</code></td>
          <td><code>cloud</code>, <code>device</code></td>
      </tr>
      <tr>
          <td><code>unity</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>cloud</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>react_native</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>flutter</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>cordova</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>warehouse</code></td>
          <td><code>cloud</code></td>
      </tr>
  </tbody>
</table>
<p>Only <code>web</code> offers <code>device</code> mode, which loads <code>analytics.js</code> in the browser. See <a href="https://www.rudderstack.com/docs/destinations/rudderstack-connection-modes/" >RudderStack Connection Modes</a>.</p>

<p><code>warehouse</code> is the token a <a href="https://www.rudderstack.com/docs/sources/reverse-etl/" >Reverse ETL source</a> resolves to. Rudder CLI manages the destination’s <code>warehouse</code> entry — if the destination is connected to a Reverse ETL source, set <code>connection_mode.warehouse: cloud</code> in its spec, or <code>apply</code> removes it.</p>
<p>Rudder CLI can also declare the Reverse ETL connection itself, for the types listed under <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-retl-connections/#supported-destinations" >Supported destinations</a> — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/retl-connections/" >Manage Reverse ETL Connections using Rudder CLI</a>.</p>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text">The dashboard additionally offers Google Analytics to AMP and Shopify sources. Rudder CLI doesn&rsquo;t manage those connections, so <code>amp</code> and <code>shopify</code> are invalid here.</div>
  </div>
</blockquote>

</html>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="connect-a-source">Connect a source</h2><p>An event stream connection to this destination is checked against two rules at <code>validate</code> time.</p>
<p><strong>The source&rsquo;s type must be supported.</strong> A source&rsquo;s type resolves to one of the tokens above before the check — a JavaScript source resolves to <code>web</code>, and webhook and server-side SDK sources resolve to <code>cloud</code>. Every type an event stream source can resolve to is supported here, so this check always passes.</p>
<p><strong>The destination config must carry a <code>connection_mode</code> entry for that source type.</strong> This lives on the destination spec, not on the <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-connections/" >connection spec</a>. Without it:</p>
<div class="rs-code">
  <div class="rs-code__head"><button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-text" data-lang="text">destination &#39;google-analytics-prod&#39; config has no &#39;connection_mode&#39; entry for source type &#39;web&#39;</code></pre></div>
</div>
<p>Google Analytics needs no additional config keys to connect a source of any type, in any mode.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="secrets">Secrets</h2><p><code>tracking_id</code> and <code>optimize.web</code> are the secret keys. Write each one you use as a <code>{{ .VAR }}</code> reference and supply the value at apply time:</p>
<div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">config:
  tracking_id: &#34;{{ .GA_TRACKING_ID }}&#34;
  optimize:
    web: &#34;{{ .GA_OPTIMIZE_CONTAINER_ID }}&#34;</code></pre></div>
</div>
<div class="rs-code">
  <div class="rs-code__head">bash<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">export RUDDER_GA_TRACKING_ID=&#34;...&#34;
export RUDDER_GA_OPTIMIZE_CONTAINER_ID=&#34;...&#34;
rudder-cli apply

# or
rudder-cli apply --var-file secrets.vars.yaml</code></pre></div>
</div>
<p>Note that:</p>
<ul>
<li><code>rudder-cli import</code> writes only the secrets the API returns, as <code>{{ .VAR }}</code> references, and leaves the others out. Add any secret key it leaves out, then supply the variables before you apply — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#secrets" >Secrets</a>.</li>
<li>In web <code>device</code> mode the tracking ID and the Optimize container ID are embedded in the page&rsquo;s JavaScript, so masking them protects your YAML, not the values themselves.</li>
<li><code>rudder_delete_account_id</code> only identifies the Google account connected in the dashboard. The account&rsquo;s credentials stay in RudderStack.</li>
</ul>
<p>See <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/variable-substitution/" >How to Use Variable Substitution in Rudder CLI</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="changes-by-release">Changes by release</h2>
<p>No changes since this type became available.</p>
<p>For changes across every destination type, see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/changes/" >Destination Type Changes by Release</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="see-more">See more</h2><ul>
<li><a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/google-analytics-ga/" >Google Analytics Destination</a> for event mappings, enhanced ecommerce, client ID handling, and user deletion</li>
<li><a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/google-analytics-4/" >Google Analytics 4 Destination Config Reference</a> for the <code>ga4</code> type that replaces this one</li>
<li><a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/" >Destination Type Reference for Rudder CLI</a> for the rules shared across destination types</li>
<li><a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-destinations/" >Destination YAML Reference</a> for the spec envelope</li>
</ul>

