Google Ads Install / Embed Tag | OpsBlu Docs

Google Ads Install / Embed Tag

How to install and deploy the Google Ads tracking tag or SDK. Covers GTM deployment, direct code installation, mobile SDK setup, server-side collection.

Installation Overview

Google Ads provides multiple methods for implementing conversion tracking and remarketing tags on your website. Choose the installation method that best fits your technical infrastructure and team capabilities.

Delivery Options

Google Tag (gtag.js) - Direct Implementation

Best for:

  • Simple websites with basic tracking needs
  • Teams comfortable editing website code directly
  • Sites without existing tag management solution

Limitations:

  • Requires code changes for each tracking update
  • Harder to test and debug changes
  • Multiple Google products require separate implementations

Google Tag Manager (GTM) - Centralized Management

Best for:

  • Sites with multiple marketing tags
  • Teams needing non-technical tag deployment
  • Complex tracking requirements

Benefits:

  • Deploy tags without code changes
  • Preview and test before publishing
  • Centralized tag management
  • Built-in debugging tools

GA4 Import - Leverage Existing Conversions

Best for:

  • Sites already using GA4
  • Teams wanting unified analytics
  • Avoiding duplicate tracking implementations

Requirements:

  • Active GA4 property
  • GA4 and Google Ads accounts linked
  • Events marked as conversions in GA4

Installation Method 1: Google Tag (gtag.js)

Step 1: Retrieve Conversion Tag

  1. In Google Ads: Tools → Conversions → New conversion action
  2. Select conversion source (Website, App, Phone calls, Import)
  3. For website: Choose manual code installation
  4. Copy the Global Site Tag code
  5. Copy the Event Snippet code

Step 2: Install Global Site Tag

Add the Global Site Tag to the <head> section of every page:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-CONVERSION_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'AW-CONVERSION_ID');
</script>

Important:

  • Replace AW-CONVERSION_ID with your actual Conversion ID (e.g., AW-123456789)
  • Install on all pages, not just conversion pages
  • Place as high in <head> as possible for early loading

Step 3: Install Event Snippet

Add the Event Snippet to conversion pages only (e.g., thank you page):

<!-- Event snippet for Purchase conversion page -->
<script>
  gtag('event', 'conversion', {
    'send_to': 'AW-CONVERSION_ID/CONVERSION_LABEL',
    'value': 1.0,
    'currency': 'USD',
    'transaction_id': ''
  });
</script>

Configuration options:

  • 'send_to': Your Conversion ID and Label (e.g., 'AW-123456789/AbC1DeFgHiJkLmNoPqRs')
  • 'value': Conversion value (use dynamic value for e-commerce)
  • 'currency': Currency code (USD, EUR, GBP, etc.)
  • 'transaction_id': Unique order ID (prevents duplicate conversions)

Step 4: Dynamic Conversion Values

For e-commerce, use dynamic values:

<script>
  gtag('event', 'conversion', {
    'send_to': 'AW-CONVERSION_ID/CONVERSION_LABEL',
    'value': <?php echo $order_total; ?>, // Dynamic from server
    'currency': 'USD',
    'transaction_id': '<?php echo $order_id; ?>'
  });
</script>

JavaScript example:

// Capture order total from page
const orderTotal = document.getElementById('orderTotal').textContent;
const orderId = document.getElementById('orderId').textContent;

gtag('event', 'conversion', {
  'send_to': 'AW-CONVERSION_ID/CONVERSION_LABEL',
  'value': parseFloat(orderTotal),
  'currency': 'USD',
  'transaction_id': orderId
});

Installation Method 2: Google Tag Manager

Step 1: Install GTM Container

Add GTM container code to your website (one-time setup):

In <head>:

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->

After opening <body> tag:

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Replace GTM-XXXXXX with your GTM Container ID.

Step 2: Create Google Ads Conversion Tracking Tag

In Google Tag Manager:

  1. Tags → New → Tag Configuration
  2. Select tag type: Google Ads Conversion Tracking
  3. Configure tag settings:
    • Conversion ID: AW-123456789 (from Google Ads)
    • Conversion Label: AbC1DeFgHiJkLmNoPqRs (from Google Ads)
    • Conversion Value: Use variable or static value
    • Currency Code: USD (or your currency)
    • Transaction ID: Use variable for deduplication

Step 3: Configure Trigger

Set when the conversion tag should fire:

Page View Trigger (Thank You Page):

Trigger Type: Page View
Trigger Fires On: Some Page Views
Page Path contains /thank-you

Form Submission Trigger:

Trigger Type: Form Submission
Trigger Fires On: All Forms
OR
Trigger Fires On: Some Forms
Form ID equals contact-form

Custom Event Trigger:

Trigger Type: Custom Event
Event Name: purchase

Step 4: Configure Data Layer (for dynamic values)

Push conversion data to Data Layer:

// On conversion page
dataLayer.push({
  'event': 'purchase',
  'transactionId': 'ORDER-12345',
  'transactionTotal': 99.99,
  'transactionCurrency': 'USD'
});

Create GTM Variables:

  1. Variables → New → Data Layer Variable
  2. Variable names:
    • transactionId → Data Layer Variable: transactionId
    • transactionTotal → Data Layer Variable: transactionTotal
    • transactionCurrency → Data Layer Variable: transactionCurrency

Use variables in tag:

  • Conversion Value: {{transactionTotal}}
  • Currency Code: {{transactionCurrency}}
  • Transaction ID: {{transactionId}}

Step 5: Test and Publish

  1. Click Preview to enter Preview mode
  2. Visit your website in new tab
  3. Verify tag fires on conversion page in GTM debugger
  4. Check that conversion appears in Google Ads (Tools → Conversions)
  5. If working correctly, click Submit to publish

Installation Method 3: GA4 Import

  1. In GA4: Admin → Google Ads Links
  2. Click Link → Select Google Ads account
  3. Configure link settings:
    • Enable Personalized advertising
    • Import site metrics
    • Include Google signals

Step 2: Mark GA4 Events as Conversions

  1. In GA4: Admin → Events
  2. Find relevant event (e.g., purchase, sign_up)
  3. Toggle Mark as conversion

Step 3: Import to Google Ads

  1. In Google Ads: Tools → Conversions → New conversion action
  2. Select Import → Google Analytics 4
  3. Choose events to import
  4. Click Import and Continue

Imported conversions appear as:

  • Source: Google Analytics 4
  • Action optimization: Available for bid strategies

Enhanced Conversions Setup

What are Enhanced Conversions?

Enhanced conversions improve accuracy by sending hashed first-party customer data (email, phone, address) to match conversions with Google accounts.

Implementation via GTM

  1. Enable Enhanced Conversions in Google Ads conversion action settings
  2. In GTM, edit Google Ads Conversion Tracking tag
  3. Enable Include user-provided data from your website
  4. Select automatic or manual data collection

Automatic Collection:

GTM automatically detects email, phone, and address fields on page.

Manual Configuration:

Map data layer variables to user data:

// Push user data to Data Layer
dataLayer.push({
  'event': 'purchase',
  'email': 'user@example.com',
  'phone_number': '+12025551234',
  'address': {
    'first_name': 'John',
    'last_name': 'Doe',
    'street': '123 Main St',
    'city': 'Washington',
    'region': 'DC',
    'postal_code': '20001',
    'country': 'US'
  }
});

In GTM tag settings, map variables:

  • Email: {{userEmail}}
  • Phone: {{userPhone}}
  • Address fields: Map each field from Data Layer

Data is hashed by GTM before sending to Google.

Implementation via gtag.js

gtag('event', 'conversion', {
  'send_to': 'AW-CONVERSION_ID/CONVERSION_LABEL',
  'value': 99.99,
  'currency': 'USD',
  'email': 'user@example.com',
  'phone_number': '+12025551234',
  'address': {
    'first_name': 'John',
    'last_name': 'Doe',
    'street': '123 Main St',
    'city': 'Washington',
    'postal_code': '20001',
    'country': 'US'
  }
});

Remarketing Tag Installation

GTM Implementation

  1. Tags → New → Google Ads Remarketing
  2. Configure:
    • Conversion ID: AW-123456789
  3. Trigger: All Pages
  4. (Optional) Set custom parameters for dynamic remarketing

gtag.js Implementation

<script async src="https://www.googletagmanager.com/gtag/js?id=AW-CONVERSION_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'AW-CONVERSION_ID');
</script>

Remarketing is automatically enabled with the Global Site Tag.

Dynamic Remarketing Parameters

For e-commerce dynamic remarketing:

gtag('event', 'page_view', {
  'send_to': 'AW-CONVERSION_ID',
  'ecomm_prodid': ['PRODUCT_ID_1', 'PRODUCT_ID_2'],
  'ecomm_pagetype': 'product', // home, category, product, cart, purchase
  'ecomm_totalvalue': 99.99
});

Validation and Testing

Google Tag Assistant

  1. Install Google Tag Assistant Chrome extension
  2. Visit your website
  3. Click extension icon
  4. Verify:
    • Google Ads tag present
    • Tag fires on correct pages
    • No errors or warnings

Preview Mode (GTM)

  1. In GTM, click Preview
  2. Enter your website URL
  3. GTM debugger opens in new tab
  4. Navigate to conversion page
  5. Verify tag fires in debugger Summary panel
  1. In Google Ads: Tools → Conversions
  2. Find your conversion action
  3. Check Status column shows "Recording conversions"
  4. Perform test conversion on your site
  5. Conversion appears in Google Ads within a few hours

Browser Developer Console

Check for errors:

  1. Open browser DevTools (F12)
  2. Go to Console tab
  3. Look for gtag or GTM errors
  4. Verify Data Layer pushes (for GTM)

Check Data Layer:

// In browser console
console.log(dataLayer);

Test Conversions

Important: Test conversions count toward your totals. To avoid:

  • Use Google Ads test conversion feature (limited availability)
  • Filter internal traffic by IP address in Google Ads
  • Test on staging environment before production

Troubleshooting

Tag not firing:

  • Verify tag installed on correct pages
  • Check for JavaScript errors blocking execution
  • Confirm GTM container is published
  • Verify correct Conversion ID and Label

Conversions not recording:

  • Allow up to 24 hours for first conversions to appear
  • Check conversion action is not paused
  • Verify GCLID parameter present in URL after ad click
  • Confirm tag fires after page load completes

Duplicate conversions:

  • Use transaction_id to deduplicate
  • Ensure tag doesn't fire multiple times
  • Check for duplicate tag installations

Enhanced conversions not working:

  • Verify email/phone format is correct
  • Check data is being hashed before sending
  • Confirm enhanced conversions enabled in conversion action settings

Best Practices

  • Use GTM for easier management and testing
  • Install Global Site Tag on all pages, not just conversion pages
  • Use transaction IDs to prevent duplicate conversion counting
  • Enable auto-tagging in Google Ads settings for accurate attribution
  • Test thoroughly before going live with conversion tracking
  • Document your implementation including Conversion IDs and Labels
  • Use Data Layer for dynamic values instead of hardcoding
  • Enable Enhanced Conversions for improved accuracy
  • Set up conversion value tracking for e-commerce sites
  • Filter internal traffic to avoid counting test conversions