How to track IP in Blogger

How to track IP in Blogger
This post introduces how to track IP in Blogger and fix tag manager errors.

To report potentially invalid ad clicks, you need to set up IP tracking in advance.

If you set the IP tracking setting on Blogger to track the IP on the other blog, a tag manager error will occur.

Let's see how to set up Blogger IP tracking and what to do if an error occurs in Tag Manager.

1. IP Tracking Settings

If you have obtained AdSense approval through Blogger, it is recommended to prepare in advance to track the visitor's IP in case of invalid clicks on advertisements.

It is much more convenient if your Blogger account, AdSense account, and Analytics account are in the same Google account.

First, you need to create a Google Analytics account and properties

Note here that you must click View Advanced Options to create a Universal Analytics property when creating a property.

This can be turned on by clicking the Show Advanced Options and Create Universal Analytics Property buttons. 

When you create a property, it has a Google Analytics property ID that starts with UA-. 

Copy this ID, go to the Google Blogger settings, and put it in the Google Analytics Property ID field. 

Go back to Analytics and link AdSense. 

Then tap Custom Definition and tap Custom Dimensions. 

The new custom dimension will be named IP address, and the scope will select Sessions. 

Click the Create button, complete, and it says in use. 

You need to remember the exponent number here. 

The exponent is usually 1.

2. How to setup Google Tag Manager for IP tracking

1) Create a Google Tag Manager account

After setting up Analytics, go to Google Tag Manager and create an account.

Set your account name and select the country. 

Enter the blog address exclude 「https://」 and select Web. 

Click the Create button and agree to the terms and conditions. 

2) Enter the Google Tag Manager installation code

There are two types of tag manager code: the code placed between <head> and </head> and the code placed between <body> and </body>.

Go to Blogger Settings-Theme-Customize-HTML Editing. 

Be careful with the code in the next part of <head>. 

If you paste the tag manager code as it is, &I around will be red, and if you save it as it is, an error message will appear. 

 In the Blogger, you have to replace & with &amp; to avoid an error. 

Replace & with &amp; and click save. 

Don't forget to put the code after <body> and click Save on the blogger HTML edit screen. 

3) Create Google Tag Manager Variables and Tags 

Return to the Tag Manager screen and click Variables in the left menu. 

Select the javascript variable, name the global variable skp_ip_addr, name the VAR_IP_ADDR, and save it. 

And select New Tag from the left menu. 

Click on the middle picture and select custom HTML. 

Select the content below, copy and paste it.

<script type="application/javascript">function getIP(json) {skp_ip_addr = json.ip;}</script>
<script type="application/javascript" src="https://api.ipify.orgformat=jsonp&callback=getIP"></script>

Put the code and then, in advanced settings, enter 300 for tag execution priority. Press the center of the trigger below and select All pages. 

Name it PUSH_IP_ADDR and then save it. 

4) Google Tag Manager trigger and new tag creation

Click on New Trigger in the left menu and select Load Window. 

Save the trigger name as PageView. 

Create a new tag and select Google Analytics Universal Analytics. 

Tap Enable Override this tag setting and copy and paste the UA Analytics code into your Tracking ID. 

Put exponent 1 in the custom dimension in other settings. (If the exponent number is different, insert that number.) 

Select VAR_IP_ADDR by clicking on the dimension value block shape.

Click the picture in the middle of the trigger at the bottom, select PageView, name it GA, and save it. 

5) Complete Google Tag Manager settings for IP tracking

Click the Submit and Publish and Skip Button to complete.

If you see the number tag 2 trigger 1 variable 6, you're good.

3. Create IP Tracking Analytics Custom Report

Tag manager settings are done. 

You need to go to analytics and create a custom report to see the invalid clicks of the IPs.

Create a new custom report under Customization - Custom report in the left menu of Analytics.

Give it a title, choose a type(flat table), and add dimensions IP addr / page / time / date. To the metric I add and save Page・Session/ Clicks / AdX Revenue / AdX eCPM / Pageviews / AdX Click. after a day or so, you will see the data stored in your custom report.

So far, I have discussed how to set up Blogger invalid ad click IP tracking and resolve errors when entering tag manager code. 

I hope this helps.

To learn more about blogger, check out the post below.