How To Process Google Analytics Data With Angelfish

Creation date: 5/18/2022 5:08 PM    Updated: 5/4/2024 11:30 AM
The solution described in this article works with GA4.

If you keep a copy of the tracking data sent to your Google Analytics account, you can process it with Angelfish.

The copy of the tracking data can either be sent to your local web server or to a remote server.  This data can be processed with the UGA-GA4 Tracking Method.

There are many benefits to this solution, namely:

GA BACKUP

This solution lets Angelfish provide a "backup" of your GA reports, which useful if you can't access your Google Analytics account.

FULL VISITOR DETAILS

Angelfish shows individual visitor details, like full clickpaths, usernames, IP addresses, marketing info, and a bunch more.  Plus, you can select a date range as small as a single second.

DATA PROTECTION

Angelfish is self-hosted web analytics software, which keeps your data behind your firewall.

USE EXISTING CAMPAIGN VARIABLES

Angelfish can use your existing Google Analytics Campaign Variables with a simple config update.

SEE VISITS THAT BLOCK GA

If you process your access logs with a different Tracking Method, you'll see Visits that don't appear in your GA reports.



Setup Instructions


If you have any questions about getting this working, please contact us - we're happy to help.

REQUIREMENTS

Angelfish v2.60 or newer
The ability to add a code snippet to your website, either directly or in a GTM container
Access logs in default IIS (W3C) format, or NCSA Combined format


SETUP TASKS

  • Add Code Snippet
  • Add __ga4.gif to Website
  • Locate Access Logs
  • Create a Profile & Process Data


STEP 1: Add Code Snippet


The following code needs to be placed below the GA code on your website:

// Angelfish GA4 Backup
(function() {
	var gid = 'G-S82H7S53ST',
		filepath = '/__ga4.gif',
		query = [],
		qp = ['cid','dl','dr','dt','sr','ul'],
		props = ['client_id','page_location','page_referrer','page_title','screen_resolution','language'];
	while (props.length > 0) {
		gtag('get', gid, props.shift(), (v) => {
			query.push(qp.shift()+'='+encodeURIComponent(v));
			if (qp.length == 0) {
					document.createElement('img').src = filepath + '?' + query.join('&') + '&_p=' + Math.round(new Date().getTime() / 1000);
			}
		});
	}
})();


NOTES

  • The above code makes a request for __ga4.gif from your webserver.
  • To request __ga4.gif from a different hostname, enter the full path in the "filepath" variable.  e.g.:
  • filepath = 'https://www.yoursite.com/__ga4.gif'
  • You can rename __ga4.gif - just make sure the filename is correct in the filepath variable and in your Angelfish Profile


STEP 2: Add __ga4.gif to Website


Copy the __ga4.gif file to the location that matches the filepath setting from Step 1.

You can copy the file from here:  __ga4.gif


STEP 3: Locate Access Logs


The website that accepts the request for __ga4.gif will have access logs.  Angelfish needs these logs to create reports.

Angelfish can connect to the server that contains these logs via SFTP, UNC, or FTP.  Alternatively, you can copy the logs to a location that your Angelfish instance can access.

In Angelfish, use the location of these logs to create a new Datasource.


STEP 4: Create a Profile & Process Data


In Angelfish, create a new Profile using the "GA4 Backup" Profile Template.

Profile setup details are beyond the scope of this article, but at a minimum you'll want to update these fields:
  • Hostname(s)
  • Clickable Page Prefix
  • Internal Search: Results Page Stem

Link the Datasource from Step 3 to the Profile, add Filters, and process data!