How to get Service Provider back in Google Analytics 4

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 4!

We'll give a few options depending your needs.

Super easy: These codes work for both the Gtag.js and GTM Google Analytics 4 installs.

This guide is for Google Analytics 4, for our guide for the previous version of Google Analytics click here.

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

Send Service Provider to Google Analytics 4 to Custom Dimensions:

This requires adding a few simple 'custom dimensions' within Google Analytics 4.

After this you can now filter/segment on these type of Users and display these Custom Dimensions in Explore reports. In Google Looker Studio you can select these Custom Dimensions directly and add them easily to tables and charts.

<script>
//If the following doesn't work anymore your website is probably blocked because of usage, get the Pro Package at extreme-ip-lookup.com
 function GA4getIP2(json) {
   if (json) {
   	EIPL=json;
   }
   	if (typeof gaGlobal  === 'object' && gaGlobal.vid) {
		if (!EIPL.businessWebsite) {
			EIPL.businessWebsite='(not set)';
		}
		window.dataLayer = window.dataLayer || [];
                window.eiplGIDStorageTodo = window.eiplGIDStorageTodo || {};
                window.eiplGIDStorageDone = window.eiplGIDStorageDone || {};
                eiplgtag = function (){dataLayer.push(arguments);}
                var regex = /_ga_([^=]+)/gi, result = [];
                while ( (result = regex.exec(document.cookie)) ) {
                	eiplGIDStorageTodo['G-'+result[1]]=1;
                }
                for (var GID in eiplGIDStorageTodo) {
                	if (!eiplGIDStorageDone[GID]) {
				eiplgtag('js', new Date());
				eiplgtag('config', GID, {
				  'send_page_view': false
				});
				var eiplup={ 'eipl_org_type': EIPL.ipType, 'eipl_org': EIPL.org, 'eipl_org_website': EIPL.businessWebsite };
				eiplgtag('event', 'eipl_set_service_provider', { 'send_to': GID, 'user_properties': eiplup });
				eiplGIDStorageDone[GID]=1;
			}
		}
	}
	else {
		setTimeout(function() {GA4getIP2();}, 200);
	}
 }
</script>
<script src="//extreme-ip-lookup.com/json/?callback=GA4getIP2&key=demo" async defer></script>
Replace key=demo with your API key: Get your API key.

Just send the B2B Leads and not the Residential:

Here we filter on Business and Education visitors. Residential (and hosting bots) visitors will not get send to Google Analytics 4. This makes viewing just the B2B Leads even easier in the Google Analytics 4!

This requires adding a few simple 'custom dimensions' within Google Analytics 4.

After this you can now filter/segment on these type of Users and display these Custom Dimensions in Explore reports. In Google Looker Studio you can select these Custom Dimensions directly and add them easily to tables and charts.

<script>
//If the following doesn't work anymore your website is probably blocked because of usage, get the Pro Package at extreme-ip-lookup.com
 function GA4getIP3(json) {
   if (json) {
   	EIPL=json;
   }
   if (EIPL.ipType === 'Business' || EIPL.ipType === 'Education') {
   	if (typeof gaGlobal  === 'object' && gaGlobal.vid) {
		if (!EIPL.businessWebsite) {
			EIPL.businessWebsite='(not set)';
		}
		window.dataLayer = window.dataLayer || [];
                window.eiplGIDStorageTodo = window.eiplGIDStorageTodo || {};
                window.eiplGIDStorageDone = window.eiplGIDStorageDone || {};
                eiplgtag = function (){dataLayer.push(arguments);}
                var regex = /_ga_([^=]+)/gi, result = [];
                while ( (result = regex.exec(document.cookie)) ) {
                	eiplGIDStorageTodo['G-'+result[1]]=1;
                }
                for (var GID in eiplGIDStorageTodo) {
                	if (!eiplGIDStorageDone[GID]) {
				eiplgtag('js', new Date());
				eiplgtag('config', GID, {
				  'send_page_view': false
				});
				var eiplup={ 'eipl_org_type': EIPL.ipType, 'eipl_org': EIPL.org, 'eipl_org_website': EIPL.businessWebsite };
				eiplgtag('event', 'eipl_set_service_provider', { 'send_to': GID, 'user_properties': eiplup });
				eiplGIDStorageDone[GID]=1;
			}
		}
	}
	else {
		setTimeout(function() {GA4getIP3();}, 200);
	}
   }
 }
</script>
<script src="//extreme-ip-lookup.com/json/?callback=GA4getIP3&key=demo" async defer></script>
Replace key=demo with your API key: Get your API key.
Lots of traffic? Get the Pro Package so your domain won't get blocked!