O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Practical Google Analytics and Google Tag Manager for Developers

Book Description

Whether you’re a marketer with development skills or a full-on web developer/analyst, Practical Google Analytics and Google Tag Manager for Developers shows you how to implement Google Analytics using Google Tag Manager to jumpstart your web analytics measurement.

There’s a reason that so many organizations use Google Analytics. Effective collection of data with Google Analytics can reduce customer acquisition costs, provide priceless feedback on new product initiatives, and offer insights that will grow a customer or client base. So where does Google Tag Manager fit in?

Google Tag Manager allows for unprecedented collaboration between marketing and technical teams, lightning fast updates to your site, and standardization of the most common tags for on-site tracking and marketing efforts. To achieve the rich data you're really after to better serve your users’ needs, you'll need the tools Google Tag Manager provides for a best-in-class implementation of Google Analytics measurement on your site.

Written by data evangelist and Google Analytics expert Jonathan Weber and the team at LunaMetrics, this book offers foundational knowledge, a collection of practical Google Tag Manager recipes, well-tested best practices, and troubleshooting tips to get your implementation in tip-top condition. It covers topics including:

• Google Analytics implementation via Google Tag Manager

• How to customize Google Analytics for your unique situation

• Using Google Tag Manager to track and analyze interactions across multiple devices and touch points

• How to extract data from Google Analytics and use Google BigQuery to analyze Big Data questions

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. Foreword
  8. About the Author
  9. Acknowledgments
  10. Introduction
  11. Part I: Implementing Google Analytics with Google Tag Manager
    1. Chapter 1: Google Analytics Fundamentals
      1. GA Account Structure and Administration
        1. Getting a Google Login
        2. Google Analytics Structure
        3. Administration and Access Controls
        4. Google Analytics Premium Properties
      2. How Google Analytics Collects Data
        1. Hits, Sessions, and Users
        2. Privacy Considerations
      3. Reports and Data Structures in GA
        1. Dimensions and Metrics
        2. Pre-Aggregation and Sampling
        3. Tool Overlap and Reconciliation
      4. Google Analytics Documentation
      5. Summary
    2. Chapter 2: Basic Google Analytics Measurement
      1. Basic Google Analytics Tracking Code
        1. How the Tracking Code Works
        2. Getting the Code on the Page
      2. Cookies and Domains
        1. Choosing a Cookie Domain
        2. Multiple Domains As One Site
      3. Summary
    3. Chapter 3: Introducing Google Tag Manager
      1. Why Use a Tag Manager?
      2. How Does Google Tag Manager Work?
        1. Creating a GTM Account
        2. GTM Container Script
      3. The Building Blocks of GTM
        1. Tags
        2. Triggers
        3. Variables
      4. Providing Data to GTM with a Data Layer
        1. Structure of the Data Layer
        2. Filling In the Data Layer
      5. Implementing GA Basics with GTM
        1. What Comes Next
      6. Summary
    4. Chapter 4: Testing Your Implementation
      1. Publishing in Google Tag Manager
        1. Preview and Debug Mode
      2. Publish Your Container
        1. Version Management
      3. Troubleshooting Tools for GA
        1. Chrome Tag Assistant
        2. Google Analytics Debug Mode
        3. Other Browser Tools
        4. Google Analytics Real-Time Reports
      4. Summary
  12. Part II: Enhancing Website Data with Google Tag Manager
    1. Chapter 5: Tracking Interactions with Google Tag Manager
      1. Tracking Interaction in Google Analytics
      2. Design Patterns for Events in GTM
        1. Design Pattern 1: GTM’s Auto-Event Tracking
        2. Design Pattern 2: Custom JavaScript in GTM
        3. Design Pattern 3: Explicit Data Layer Events in Site Code
      3. Applications of Interaction Tracking
        1. Outbound Links
        2. PDFs and Other Downloads
        3. Mail and Phone Links
        4. Tabs, Hover, Scroll, and Other Content Interactions
        5. Social Interactions
        6. Video
      4. Summary
    2. Chapter 6: Goals: Measuring Conversions
      1. Creating and Organizing Goals
        1. Deleting Goals
      2. Destination Goals and Funnels
        1. Setting Up a Funnel
        2. Funnels Without Distinct URLs
        3. Conversions That Span Sessions
      3. Summary
    3. Chapter 7: Ecommerce: Tracking Products and Purchases
      1. Basic Ecommerce Tracking
        1. Ecommerce Data in the Data Layer
        2. Create a Goal in GA for the Checkout Process
      2. Enhanced Ecommerce Tracking
        1. Enabling Enhanced Ecommerce
        2. Ecommerce Data in the Data Layer Declaration
        3. Ecommerce Data on User Interactions
      3. Summary
    4. Chapter 8: Cleaning Up and Enriching Data
      1. Tools for Cleaning Up Data
        1. GTM: Blocking Triggers and Overriding Default Values
        2. GA: Filters and Views
      2. Partitioning Internal Traffic
        1. Removing Internal Traffic
        2. Separating Test and Production Environments
      3. Cleaning Up and Grouping Content
        1. Enforcing Case in URLs
        2. Default URLs
        3. Query Parameters
        4. Capturing the URL Fragment
        5. Viewing Hostnames for Subdomains and Cross Domains
        6. Site Search
        7. Grouping Content
      4. Other Applications for Filters
        1. Filtered Views vs. Segments
      5. Summary
    5. Chapter 9: Measuring Campaigns and Troubleshooting Traffic Sources
      1. Traffic Sources in GA
        1. Adding Organic Search Engines
        2. Ignoring Certain Referrers
        3. Campaign Tracking
        4. Specifying Campaign Values with GTM
        5. Channel Groupings in GA
      2. Traffic Data Integrations
        1. AdWords
        2. DoubleClick Platforms
        3. Google Search Console
      3. Troubleshooting Traffic Sources
        1. Redirects
        2. Self-Referrals
      4. Summary
    6. Chapter 10: Tracking Users Across Devices
      1. Set Up User ID in GA
      2. Send User ID Data with GTM
        1. Provide a User ID Value
        2. Set Up GTM to Send User ID to GA
      3. Summary
    7. Chapter 11: Providing Additional Data About Users
      1. Custom Dimensions and Metrics
        1. Dimensions
        2. Metrics
        3. Accessing Custom Dimensions and Metrics in GA
      2. Setting Up Custom Dimensions and Metrics
        1. Creating a Custom Dimension or Metric in GA
        2. Generating Custom Data
        3. Sending Custom Information to GA
      3. Additional Examples
        1. Custom Dimensions from Form Input
        2. Custom Metrics from Interactions
      4. Summary
  13. Part III: Collecting Data from Other Sources
    1. Chapter 12: Importing Data into Google Analytics
      1. Data Import Process
        1. Creating a Data Set
        2. Data Import Schema
        3. Uploading Data
        4. Updating Data Sets
      2. Data Import Types
        1. Hit Data Import
        2. Extended Data Import
        3. Summary Data Import
      3. Summary
    2. Chapter 13: Collecting Data from Mobile Apps
      1. GA for Mobile Apps
        1. App Properties and Views
      2. Mobile App SDKs
        1. Android and iOS
        2. Unity
      3. GTM Containers for Mobile Apps
        1. Differences from Website Containers
        2. The Data Layer in Mobile Apps
        3. Deployment and Testing
      4. Summary
    3. Chapter 14: Sending Data from Other Sources Using GA’s Measurement Protocol
      1. Sending Data
        1. HTTP Request
        2. Payload Parameters
        3. Validation
      2. Data Processing in GA
      3. Summary
    4. Chapter 15: Using Google Analytics with BigQuery for Big Data Analysis
      1. About BigQuery
        1. What BigQuery Is Not
        2. GA and BigQuery Integration
      2. Accessing BigQuery
        1. Web Interface
      3. GA Data Schema in BigQuery
      4. BigQuery’s Query Language
        1. Selecting Data from Tables
        2. Grouping Fields
        3. Finding Data Where a Condition Is Met
        4. Further Google Analytics Examples
        5. Joining Data
      5. Strategies for Using GA and BigQuery in Big Data Analysis
        1. Importing Data into BigQuery
        2. Extracting Data for Use in Other Applications
      6. Summary
    5. Appendix A: Google Tag Manager and Google Analytics APIs
      1. Google API Basics
      2. Google Tag Manager API
        1. GTM Container JSON Format
        2. Google Analytics APIs
        3. Reporting APIs
        4. Configuration APIs
  14. Index