I had a lot of problems setting up Google Analytics 4 for my www.MarkDKBerry.com website, but I got there eventually. There is not much help out there, but here is how it went for me working it out. I hope it helps anyone else struggling to figure it out.


Pretty simple – To track outbound clicks from every page on www.MarkDKBerry.com while retaining some user info on the way.


My first attempt was a mess. It turns out that you cannot work this out by gung-ho smashing into it and hoping for the best. I soon had to start over. I also soon discovered that I needed both Google Tags Manager (GTM) AND Google Analytics 4 (GA4), and to setup the GTM first!



GTM is actually pretty good once you follow the correct setup procedure, and I got that from the following web site and his free e-book (this is a plug to say thanks, because without this, I would not have figured it out) – https://www.analyticsmania.com/p/getting-started-with-google-analytics-4/

FYI GTM is what tracks actions on your web site and sends that info to GA4, you can do it just in GA4 but I tried and it did not work for me GTM provides better info in debug. I recommend that you just follow the instructions in the above ebook and do it all in the right order! Here is the basics of what I did…

Make the Google Tag Manager (GTM) container for your web site

Follow the e-book instruction to figure these steps out but its pretty straightforward…

You get to the main GTM page as per above, and here you can see your revisions but the important stuff is the tags, triggers and variables and also the code you need to put into all your website html pages…

Put the code into all your html pages

On the main GTM page there is a GTM number in the top bar (hidden in my previous image for security purposes), click on that, and it will give you the code above that you need to put in all your html pages as per the instructions. (One goes in the start of the head section, and the other in the start of the body section. Do this on each html page of your site that you want monitor).


At this point, I discovered that I already had some code in my html from an old Google Analytics (UA) install that I forgot about. I took it out, but it caused me a headache later. Despite deleting all instances and clearing caches, one or two pages kept sending out to the old UA code despite no longer existing (they must have been cached somewhere, but damned if I could clear them out). I could not figure it out, so in the end I changed the name of the offending html pages rather than fight it. I explain how you spot this issue in GTM a little later.

Make the GA4 property

At this point I had to setup the Google Analytics 4 property (I think… just follow the e-book it tells you when to do what)

Follow the ebook for details (Note that the image above shows my datastream recieving traffic, you wont see this at first but you need to come back here later to check for that).

When you click on the data stream itself it then shows you the default data it will collect, but also the Data Stream ID which you then need to copy and add into GTM as a Tag…

Add the GA4 Data Stream ID into GTM as a tag, this is so GTM knows where to send the data it collects. See the ebook for the details but again, its fairly straightforward.

Add in the bespoke triggers. I called my one Link_Click_Triggers and used the “Just Links” option, it was also pretty straightforward fro the ebook.

(I have html coded buttons on linktree.html and this was enough to capture clicks on those.)


I’ll mention it now. This did not work for my music.html page because music.html originally pulled linktree.html in as an “embedded” page and GTM did not recognise the clicks in that when embedded. So to resolve this, I had to mirror the buttons html code from linktree.html into music.html instead of embedding the page, and then it worked.

Enable The Variables

I only needed the pre-configured ones it turned out, but from the list in the above image some required enabling and setting.

My main aim is to capture the inbound referrer page, and then the outbound clicks of both the domain and the URL. E.g. if someone comes from an advert on some random site, then clicks on a link on my site and goes out to Amazon, or Youtube, or Spotify, or my Bandcamp page, I want to know about where they came in from and where they went out to. I also might want to know their country of origin, and age, the browser and device they used, and so on. Some of that data is already passed on by default, the rest needed enabling here. You can probably get pretty deep into this granular stuff but for now I want to keep it simple.

There is also the growing issue of EU style privacy control, it may be that we soon cannot collect this kind of info from EU people without asking first and that throws up other issues but for now this should be okay. Privacy is important after all.

Test Preview and Debug

That was it for GTM setup, now I just needed to test it and do any Debugging.

The way you test it, is using the GTM “Preview” button in top right of the GTM main page. This then opens a page showing your GTM ID number and asks for your website, I put in https://www.markdkberry.com and it then opened a browser page (see image above) with a message in the bottom right corner to show GTM is connected to it in Debugger mode.

Now start clicking things – menus, buttons, scroll up and down, do stuff.

Check GTM is collecting what you need

With the debug browser window still open on your website, go to your other browser, or tab, that is the GTM page and click through to “continue” and you should see the Tag Assistant Page (image above) has opened which will show you what GTM is watching.

Go back to your browser debug website and click on some more stuff. Then go back to Tag Assistant window and see if it registered the actions like in the image above on the left hand side you can see the page I clicked on – Home page and then Music page (tunes.html)


Note the two ID numbers in the top of the window in the image above (I have scratched over them in black). One is this GTM ID and the other is the GA4 ID which shows they are live and connected and you can click on either to see what info they are recieving. They popped up when I clicked on the web site in preview debug mode.

This is where I got clued up to the problem with an old version of Google Analytics, as it was showing another UA-xxxxx ID up there when I clicked on certain pages. (I would not have found this out without GTM). So data was being sent somewhere else, to UA-xxxx, yet that did not even exist anymore and there was no code sending it. All this was happening despite removing the html code, clearing the caches. Just weird and it remains a mystery. The solution for me, as I said, was to rename the html pages that kept sending out to UA-xxxxx and that fixed it.


This issue came up later on, but on my test machine my default browser is BRAVE browser (in the above images it’s Firefox). Brave worked okay in debug mode, but when it came time to go live, I stopped getting data sent to GA4 and spent ages going through the possible causes only to eventually realise…Doh! Brave browser blocks Google Analyser traffic by default!!!!!!

Which I guess proves that the Brave Browser is good at protecting you from Google Analytics, but is annoying when it is you who is trying to watch who is clicking on your website. Brave browsers wont get logged by google Analytics in default privacy mode. It is an interesting point to consider regards user privacy.

So did the outbound clicks get tracked by GTM?

To test outbound clicks, I clicked on the www.markdkberry.bandcamp.com button link from my music.html page and it opened a new browser window in bandcamp.com as it was supposed to (Something to note here is that if a click opens in the same browser tab it probably wont count as an outbound click).

I then went over to the Tag Assistant browser (see the image above) and sure enough, you could see it registered my Link Click of the button, but it said TAG NOT FIRED. which made me think it had not registered it, but it had…

When I looked in the Link Click “Data layer” tab, I could see it had caught the info of the outbound URL.

Cool! Now I needed to make sure it really was going to GA4.

GA4 Realtime

Go to GA4 and click on “Realtime”. If everything is working you should see a variety of things showing up here.

This is also where I started to realise GA4 only retains data for 30 minutes. I was not getting my clicks showing up at first. (During this process keep GTM open in debug mode, and the GTM debug browser open too so you can jump back and click on things every few minutes, it’s pretty cool to see it happening live once it starts working but remember this is debug mode not live, you ain’t done yet).


I found some small print somewhere saying it takes 30 minutes for data to show up first time, but I found some showed up immediately in the Realtime window of GA4, but this was once I fixed the issues mentioned already, so be aware if you are setting up, it might take time to arrive first time. Check your property data stream in GA4 for it to tell you if it is receiving data in the last 48 hours.


Alas GA4 is where the real headache started for me tbh, I am not a great fan of GA4 because if it, but once I got through the worst of it, hey, maybe it is going to be okay in the end…except for their reporting which sucks balls imo…

GA4, Setting up to catch the clicks from GTM

Setup Events to register clicks. I changed the configs above so that clicks would be collected and I am not bothered about scrolling info, for now. I don’t want to bog myself down with info yet.

Setup conversions. Er…wtf is a conversion? I dont know, but I set them up anyway since it said clicks and I want to track clicks.

Okay, I went gung-ho again here and started just messing with stuff. Sure, I know the rule – “Never get out of the boat”, but we are past the e-book now and into uncharted territory, this is bat country…

GA4 debug view. This I like. It’s pretty self explanatory. You see the above when you don’t click anything for a while…

And you see the above when you do click on your GTM Browser Preview debug page website…you hope…

And look at that, it took about 10 seconds to catch up with whatever I was doing, but they came through and when I clicked on the music.html button for the Spotify link, it showed me the URL and the domain (see above image “open.spotify.com“).

So its working! Woohoo! Kinda…

This at least means the right data is going to GA4 from GTM in preview debug mode...

So, that was in Debug Mode, what about live?




Okay, it’s one thing when the preview & debug is working, but when you close all that preview and debug stuff, and then everything stops working in GTA4, eventually you realise you did not follow the e-book to the letter and jumped out early.

YOU MUST SUBMIT!!!!!!! This then makes your GTM go live, and it conveniently saves versions too, so that when you fiddle with something and it goes wrong you can go back to a working version.


Make sure your browser is sending the traffic when live and not just sending it when in preview debug. Too much for this post…Google it, there’s info about how to find out.


By default it might be filtering out your ip address in GA4 so your traffic is considered local and gets ignored when not in debug mode.


I disabled the filters, but it still ignored me…I have no idea why, but it did for a while.


Rather than list all the other problems I ran into, the author of the ebook has also kindly doco’d up some of the main ones here – https://www.analyticsmania.com/post/google-analytics-real-time-reports-not-working/

Good luck, amigo!

And onto Reporting, and in GA4 frankly…yuk.

GA4 is awful for reporting, imo…I lost a day and some hair on the GA4 side of things.

Long and short of it…you need to setup Custom Definitions (maybe even to get clicks in the realtime window, but defo for the reports, can’t remember exactly what order I did stuff in as I was blowing mental fuses at this point).

The naming of the custom definitions in the above image was mine, but the link_domain and link_url were the defined parameters I wanted to capture from GTM and show some report on.

Setting up Reports (You have to go to Analysis, Analysis Hub. Why not just call it reports? I think Google enjoy being difficult).

I setup using the Exploration template. I just wanted it simple. I think this hub layout sucks. It lost data, it dropped saved fields, it generally is balls. It can’t even export the names of my custom definition, it renames them. It also randomly changes the dates I want for the report and deleted all the info in a saved report for no reason.

It is balls, I tell you.

But eventually I got something out of it, and it looked like the image above. The other massively balls issue is that you can only put 5 rows in (which are actually the columns). Wtf is the point of only 5 columns? Yes, GA4 reporting is BALLS!!!!!!

but I got stuck on an even more annoying aspect of it…

The dreaded “(not set)”

Also known as…


My website doesn’t get much traffic (In fairness, I am in the process of starting out fresh with my new artist name and so my streams and advert traction is currently nil, but that’s another story I plan to remedy soon, and hence why I am setting all this up in preparation).

All I saw for an entire day was “(not set)” in the reports, even when I could see outbound clicks showing up in the RealTime windows, I could not get the info of the URL or Domain to show up in the reports. One whole day on this. Nothing. No clues out there on Google search either. Nada. There are no clues for what (not set) means exactly, no trace back at all.

I went to bed and got up, and then got ready for the second day of battle with GA4’s BALLS UP! of a reporting system, and look…

There it was. If I could kiss that person from Paloma in Italy I would. Why does Google make this so uninformative and lacking in tracing solutions? I dislike Google software designers at times, a lot.

The problem was not that I was not getting the data (not that GA4 told me anything of use), the problem was the GA4 was still screening me when I tried to click on links, but only for the Reports, yea, thanks for that. Even live, I had got it to register the URL link in Realtime and tell me what websites I clicked out to, but not in the reports. I guess it just needed a customer…I would have lost another day to this, if it was not for that person in Italy, now my favourite fan. I had no idea.

Anyway…so this is now working, it seems. I might report back in a month once a campaign gets underway and let you know how it all went. I am also willing to put 20 bucks on Google Designers changing something to break it, and me then spending another day confused as to why and with ZERO informative help to work it out.