Why does Google Analytics show zero session time when using Selenium WebDriver

I’m trying to automate website visits using Selenium with Python but I’m having issues with Google Analytics tracking. Here’s my current approach:

driver = webdriver.Chrome()
driver.get(website_url)
time.sleep(25)
driver.quit()

When I check the analytics dashboard later, the session duration shows up as zero seconds. I thought maybe I needed some user interaction, so I modified my script to click on an element:

driver = webdriver.Chrome()
driver.get(website_url)
time.sleep(35)
element = driver.find_element_by_css_selector(selector)
element.click()
time.sleep(15)
driver.close()

But the results are still the same - zero duration in Google Analytics. What could be causing this problem? Is there something specific about how Selenium interacts with GA tracking that I’m missing?

Chrome WebDriver leaves fingerprints that Google Analytics picks up to flag automated traffic. Your interactions and delays help, but the webdriver property still shows in the DOM. Plus GA looks for missing plugins, weird navigator properties, and robotic timing patterns.

I ran into this same problem testing our analytics setup. Here’s what fixed it for me - modify Chrome options to look more like real browsing:

from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument('--disable-blink-features=AutomationControlled')
options.add_experimental_option('excludeSwitches', ['enable-automation'])
options.add_experimental_option('useAutomationExtension', False)

That said, GA’s bot detection keeps getting smarter. If you’re just testing your own sites, try GA4’s debug mode instead or set up a separate property for dev testing.

Google Analytics blocks automated traffic by default, so Selenium WebDriver gets filtered out. Your code’s fine - GA just knows you’re using automation. I ran into this testing our conversion tracking. GA checks for missing referrer data, weird browser fingerprints, and automated JavaScript patterns. Selenium hits pretty much all these triggers. You’re getting zero session duration because GA either ignores the session completely or flags it as bot traffic. Adding interactions won’t fix it once the automation detection kicks in. For legit testing, try setting up a separate GA view with bot filtering turned off, or use GA’s Measurement Protocol API to send custom events directly. Just don’t bypass these protections unless it’s your own site for testing.

Yeah, Google Analytics spots Selenium pretty fast. It leaves obvious fingerprints that GA just filters out automatically.

The problem is Selenium doesn’t handle JavaScript like real browsers. GA needs specific events and timing patterns - automated browsers screw these up.

I hit this same wall testing our marketing funnels. Rather than fight Selenium detection, I switched to Latenode and it actually works.

The key is using real browser automation that doesn’t scream “bot.” Latenode mimics genuine user sessions - proper timing, natural interactions, stuff GA actually records.

You can build scenarios that visit pages, scroll like humans do, click with realistic delays, even vary user behavior. Analytics picks up these sessions as real traffic because they look legit.

Best part? You can scale without wrestling Chrome drivers or worrying about detection.

Check it out: https://latenode.com