Tuesday, November 21, 2023
HomeWeb AnalysisWhat is IP address measurement issue in AMP Analytics?

What is IP address measurement issue in AMP Analytics?

AMP analytics has had some issues, most recently due to different domains hosting the Client ID cookie.

Actually, besides that, I noticed that there is a problem with the IP address, so I will share that problem.

Problem overview

One of the parameters I’m sending to Google Analytics is an unfamiliar item called “aip”. This indicates whether to anonymize the IP address, and if this value is specified, the last number among the four numbers of the IP address will be measured as “0” (aip’s Regardless of the value of the parameter, if the aip parameter is included, it is automatically enabled).

In other words, if the original IP address is ‘’, Google Analytics will anonymize this IP address and record it as ‘’.

As explained in the official help ” IP Anonymization in Google Analytics “, this feature is intended to meet the requirement that some countries prohibit the storage of full IP address information. is thought to exist in

In the web version of Google Analytics, this “aip” parameter is not specified by default, and anonymization processing is not performed.

Issues with AMP Analytics

In fact, in AMP Analytics, the default value of this “aip” parameter is specified as true. I noticed this issue while researching Issue Why doesn’t Google AMP Analytics adhere to tracking filters? #665 posted to amp-by-example on Github .

If it is a regular version of Google Analytics, IP anonymization is not performed, so there is no problem if you enter your own static IP address as it is as the IP address to be set in the IP address exclusion filter. However, in AMP Analytics, the IP address is anonymized at the very first stage of processing and the trailing part is rewritten to “0”. Therefore, even if you put your own IP address directly into the exclusion filter, there will be no matching IP address, and you will not be able to exclude internal traffic correctly.

If you really want to exclude it, you can consider setting the end of the IP address set in the exclusion filter to “0”, but the range of IP addresses to be excluded becomes wide, so you can exclude unnecessary ones. Therefore, sufficient consideration must be given when implementing it.

AMP Analytics developers are probably from neighboring countries of the EU.

I created an Issue ” AMP Analytics: Make the “aip” parameter changeable to false ” on amphtml’s Github, as I thought that AMP Analytics measurement would be problematic if this continues. This issue was implemented around April 2017 and incorporated into the master branch, allowing general AMP Analytics developers to work around the issue.

To avoid being affected by IP address anonymization

In order not to be affected by IP address anonymization, the developer needs to change the tracking code installed on the AMP site. And this change is a bit tricky so you have to be careful.

In order not to be affected by IP address anonymization, the code in the official Google Analytics developer help should be changed as follows.

<amp-analytics type="googleanalytics" id="analytics1">
<script type="application/json">
  "vars": {
    "account": "UA-XXXXX-Y",
    "anonymizeIP": "" // ここを追加する
  "triggers": {
    "trackPageview": {
      "on": "visible",
      "request": "pageview"

I would like to specify the value of anonymizeIP as true or false, but the aip parameter will be anonymized when the aip parameter exists even if the value is not specified (or false), so implement it with a simple setting didn’t seem to be able to. By the way, the default value of this “anonymizeIP” is “aip”, which seems to be used as the parameter name.

Further complicating the matter is that this is currently not possible through the AMP version of Google Tag Manager . So, at the moment, there are 3 possible ways to deal with this problem:

  • It will be excluded extra, but set the end of the IP address to 0 in the view filter
  • Using JSON Tracking Code Without Using AMP Google Tag Manager
  • Give up on excluding IP addresses

For me, the degree of freedom of the AMP version of Google Tag Manager is still low, and there are many other functions that cannot be used with Tag Manager. I think you will select “Yes” .


AMP is evolving rapidly, and even in Japan, it has been introduced on the major gourmet site “Tabelog”. In Tabelog, the AMP page is finished like a normal mobile page, and it is expected to spread in Japan in the future.

On the other hand, we’re also seeing some issues (although the only ones I’m watching are Analytics-related). For further spread in the future, I would like to aim for a situation where it can be used stably in terms of analysis.


Leave a reply

Please enter your comment!
Please enter your name here

Recent Posts

Popular Posts

Most Popular

Recent Comments