How to get Service Provider back in Google Analytics

Google Analytics removed the Service Provider and Network Domain dimensions on February the 4th, 2020. From off that date they report just '(not set)'.

Through our IP API you can get this information (and more!) back in Google Analytics!

We'll give a few options depending your needs.

Lots of traffic? Get the Pro Package so your domain won't get blocked!

Send Service Provider to Google Analytics as an Event:

Just add the following code to your site and you're done. Somewhere in the footer for example. It doesn't need any setup within Google Analytics. Another pro is that you can view the data directly on the home screen in the Google Analytics mobile app. Con is that it's not selectable as a secundary dimension in Google Analytics as easily as if you would send it to a Custom Dimension, check the Custom Dimensions option below on how to set that up.

<script>
 function getIP(json) {
   if (json) {
   	EIPL=json;
   }
   if (EIPL.org) {
   	if (typeof ga === 'function' && typeof ga.getAll() === 'object') {
		ga(ga.getAll()[0].get('name')+'.send', {
		  hitType: 'event',
		  eventCategory: 'eXTReMe-IP-Lookup.com',
		  eventAction: 'ISP',
		  eventLabel: EIPL.org,
		  nonInteraction: true
		});
	}
	else {
		setTimeout(function() {getIP();}, 200);
	}
   }
 }
</script>
<script src="//extreme-ip-lookup.com/json/?callback=getIP" async defer></script>

Send Service Provider to Google Analytics to a Custom Dimension:

This requires setup within Google Analytics. Goto Admin > Property > Custom Definitions > Custom Dimensions and click the red '+ NEW CUSTOM DIMENSION' button. Fill in 'ISP' for example and choose Session as Scope, click Create then on Done. Remember the Index number of this Custom Dimension. Change the 1 in 'dimension1' in the code below with your Index number. Then add it this code somewhere in your footer and you're done!

Important, do not forget: Change the 1 in 'dimension1' in the code below with your Index number.

<script>
 function getIP(json) {
   if (json) {
   	EIPL=json;
   }
   if (EIPL.org) {
   	if (typeof ga === 'function' && typeof ga.getAll() === 'object') {
		ga(ga.getAll()[0].get('name')+'.send', {
		  hitType: 'event',
		  dimension1: EIPL.org,
		  nonInteraction: true
		});
	}
	else {
		setTimeout(function() {getIP();}, 200);
	}
   }
 }
</script>
<script src="//extreme-ip-lookup.com/json/?callback=getIP" async defer></script>

Why stop there, let's make it really interesting:

Also send the ipType value and you'll be able to seperate your visitors by Business, Education and Residential. Get B2B leads right into Google Analytics, and view them easily in the Google Analytics mobile app on the homescreen!

<script>
 function getIP(json) {
   if (json) {
   	EIPL=json;
   }
   if (EIPL.org) {
   	if (typeof ga === 'function' && typeof ga.getAll() === 'object') {
		var org=''+EIPL.org;
                if (EIPL.businessName) {
                	org=''+EIPL.businessName;
			if (EIPL.businessWebsite) {
				org+=' - '+EIPL.businessWebsite;
			}
		}
		ga(ga.getAll()[0].get('name')+'.send', {
		  hitType: 'event',
		  eventCategory: 'eXTReMe-IP-Lookup.com',
		  eventAction: EIPL.ipType, // sends Business, Education or Residential as type of visitor
		  eventLabel: org, // sends Service Provider if Residential or the Business/Education name and if available the domain of the Business/Education
		  nonInteraction: true
		});
	}
	else {
		setTimeout(function() {getIP();}, 200);
	}
   }
 }
</script>
<script src="//extreme-ip-lookup.com/json/?callback=getIP" async defer></script>

Just send the B2B Leads and not the Residential:

Yes, here we'll add a check if the visitor isn't a Residential to filter out the Residentials. This makes viewing the B2B Leads even easier in the Google Analytics mobile app on the homescreen!

<script>
function getIP(json) {
   if (json) {
   	EIPL=json;
   }
   if (EIPL.ipType !== 'Residential') {
   	if (typeof ga === 'function' && typeof ga.getAll() === 'object') {
		var org=''+EIPL.org;
                if (EIPL.businessName) {
                	org=''+EIPL.businessName;
			if (EIPL.businessWebsite) {
				org+=' - '+EIPL.businessWebsite;
			}
		}
		ga(ga.getAll()[0].get('name')+'.send', {
		  hitType: 'event',
		  eventCategory: 'eXTReMe-IP-Lookup.com',
		  eventAction: EIPL.ipType, // sends Business, Education as type of visitor
		  eventLabel: org, // sends the Business/Education name and if available the domain of the Business/Education
		  nonInteraction: true
		});
	}
	else {
		setTimeout(function() {getIP();}, 200);
	}
   }
 }
</script>
<script src="//extreme-ip-lookup.com/json/?callback=getIP" async defer></script>

Set this up in Google Tag Manager:

All the options given above are with directly adding code to your pages and or GTM, if you rather do this in a more Google Tag Manager way please read this great and extensive article from 3Whitehats:

https://www.3whitehats.com/knowledge/how-to-get-service-provider-back-in-google-analytics/

Lots of traffic? Get the Pro Package so your domain won't get blocked!