X
    Categories: Resources

Measuring IPv6 Traffic with NodeJS and Google Analytics

Some Questions That Keep Us Up At Night

Recently we found ourselves wondering – how many of our website’s visitors are capable of utilizing IPv6 traffic? Of course, there are a number of places out there where you can see global IPv6 adoption rates [link] and other IPv6 statistics. But, we wanted to see what the traffic looked like out in the wild on our own site. Here are some questions we wanted to answer:

  • Is most IPv6 traffic on mobile or desktop?
  • What brands of mobile devices are most likely to use IPv6?
  • Which countries are bringing the most IPv6 traffic?
  • Are there any noticeable behavioral differences between IPv4 and IPv6 traffic?

 

Enter Javascript

To answer these questions, we created a simple JS script which sends a GET request to a domain with an AAAA record (IPv6 address only) to see if the client supports IPv6 traffic. If the request fails, it sends another request to an IPv4 domain so the server can record how many clients do and don’t support IPv6 traffic. We created a small GUI to report the results.

We’re putting the code online with instructions for implementing this on your own site:

https://github.com/6connect/ipv6-website-stats

There’s also a separate GUI for showing the results which can be found here:

https://github.com/6connect/ipv6-website-stats-gui

We also send an event to our Google Analytics account so that we can segment our Analytics reports based on whether the traffic was or was not IPv6 capable. This lets us answer some of the more interesting questions mentioned above.

The setup for this is simple – for each pageview we send a Google Analytics event labeled either IPv4 or IPv6. We then create custom segments matching those labels so that for any report in Google Analytics we can divide the traffic based on the user’s IPv6 capability.

Initial Results

Here’s our GUI for viewing the raw results

Interestingly the ratio of IPv6 to IPv4 traffic on our site is nearly identical to the global adoption of just over 25%. Substantially more of the IPv6 traffic is on mobile devices as compared to IPv4.

IPv4 vs IPv6: Most Common Device Brands

Looking at Google Analytics we see some differences in most common device brands between IPv4 and IPv6 traffic. In particular, Samsung has a larger percentage of IPv6 traffic than it does IPv4.

IPv4 vs IPv6: Most Common Web Browsers

IPv6 traffic appears to come from a broader range of browsers than IPv4 which is completely dominated by traffic from Google Chrome.

IPv4 vs IPv6: Most Common Countries

We also looked at countries for both IPv4 and IPv6 traffic and noticed that the United States has a larger share of IPv6 traffic. This matches our expectations based on global adoption.

Spotting Bots

We also noticed a spike in IPv4 traffic that did not have a corresponding spike of IPv6 traffic. We would expect organic spikes in traffic to affect IPv6 and IPv4 traffic similarly, but all of this traffic was over IPv4. After digging in a bit more we realized that this spike of traffic came from a network of bots. It gave itself away in part because none of the traffic was IPv6 capable.

What’s Next

It’s been fun setting this up and measuring the results on our own site. Are there any other questions that come to mind? What else could we measure using this approach? Take a look at the code and let us know if you have any questions or ideas.

 

Pete Sclafani:
Related Post