I’m sorry there hasn’t been more movement on this yet. We do have people looking into it, but I’m afraid I don’t have any updates to share.
I appreciate it may not be moving fast enough for you, but we do care about all Discourse sites. If I could wave and wand and make it all come good I would certainly do that.
I wish you the best of luck with your move though, and I’m sorry to see you go.
Thanks for your help @JammyDodger - The reason I said it feels like no one cares is due to the tumbleweed through this thread and previous iterations of this issue on here unfortunately. Not expecting a magic wand but after 2 months, there’s little to no sign that anyone is looking into it and I really need to be up and running before January.
Over the last few months, I have been in talks with two large ad agencies and when they saw/heard I was on Discourse they ended the talks, I tried the AdButler integration with self serve ad system, and while AdButler counted a load of impressions the self-serve ad system only registering a tiny fraction of the pageviews/ad requests.
I am currently running with an ad provider who claimed they had worked with Discourse before but when I spoke with their dev he said they hadn’t actually used Discourse, but they had success with SPAs previously. Currently, the ads are running and while they are getting decent impressions it’s still far short of what it should be, unfortunately.
Sorry to have to go after 7 years on Discourse but I have wasted day after day trying to get this to work and was making no progress.
We hear you and have this prioritized. It is a very tough one to work on cause we need full access to both our Discourse logs and Google logs.
@MarkDoerr has a relationship now and access to one of our customers that has this configured, we are investigating where it takes us. It could take weeks or even months to work out.
We will certainly update here as we come up with various findings. We want ads to work great on the Discourse platform, but need to know exactly what needs improving.
I’ve been waiting a long time to see this problem taken care of. I can’t wait for the work to be finished. I hope there will be some progress. I would be grateful if the problem is fixed. @sam
I just merged this fix which means that transitions between similar pages (e.g. topic → topic, or topic-list → topic-list) will now correctly reload any ad units on the page. That should lead to a slight increase in impressions - the precise amount will depend on usage patterns.
I can’t find any information from Google about how they calculate the pageview metrics for Adsense.
Discourse is a Single Page Application (SPA) which means that navigations around the forum are not ‘real’ pageviews. Google Analytics and Discourse’s own metrics understand this, and track the fake pageviews.
It’s possible that Adsense only counts ‘real’ pageviews. If so, then that would explain the lower numbers when compared to GA/Discourse.
We call: window.adsbygoogle.push({}) when we are ready for adsense to populate ads.
This is pretty much all the fidelity we have here.
What I have observed:
Google tends to fill in the same ad over and over after a push call. It’s like you need a “sleep for 5 seconds call, so iframe loads up” prior to a next push call (and next <ins element) to get different ads.
When scrolling through long topics … eventually ads break, when they break, it is no more ads from that point onwards until you reload the page, the error is not surfaced to us, when catching exceptions I see it here in the obfuscated code:
Non minified adsense so we can help debug what this exception is and why adsense goes into 100% broken mode
Possibly a .reset() API that we could call on route transitions. Javascript can not be unloaded and we have no way of resetting internal state in adsense.
Better public guidelines for PWA usage and richer APIs
We have some contacts at Google, will see if we can send this through and if they can help.
Situation should be a bit better post David’s fixes, but I think we just hit a brick wall.
Glad to see some progress on this, although it sounds like Google is not going to play ball.
just to add to this now on my new site, it appears that Discourse drastically overestimates the PageViews on GA4 as well, it’s hard to tell exactly as midweek is the quieter time on my site and I’m basically at the end of the season for my niche, but even so i think my pageviews were inflated by 20-40% - compared to a more traditional setup (which basically works the same).
Of course, some of the discrepancies could be down to the move, etc, but just adding here as it might be a clue that helps someone figure something out hopefully.
Just for full disclosure, there is no aspect of estimation when discourse counts a page views, we count based on server side activity, GA counts based on what users decide to tell it
To clarify, I didnt mean the difference between Discourse PageViews and GA4 page views.
I mean GA4 running on Discourse seems to overinflate the number of page views compared to GA4 running on a more traditional Forum setup with the same number of users.
I think GA4 on Discourse is seeing lots of phantom pageviews. Having just changed over, I think I’m now getting a much closer number to the levels discourse was counting as page views, but actually minus the crawler total, on my GA4 now.
I know switching system etc could casue a wobble and the season is winding down so i expect the site to get a little less busy but seems a huge dive in PageViews, we had maintained the URL structure as much as possible to minimise distuption.
Actually looking back at my Google analytics from the year before, using Universal Analytics on Discourse they’re much more in keeping with my traffic since Tuesday, so I actually think there’s an issue with GA4 and the pageview data it is seeing on Discourse.
… and confusingly, Google AdSense is seeing only a fraction of them as well.
I feel this is kind of going in lots of directions Shane, so let me summarize some stuff:
Pageview numbers from adsense should be ignored. According to Google, adsense does not play nicely with SPAs, it only counts 1 page view per visit.
We have a reproducible bug with adsense, where it just 100% stops working after a certain amount of scrolling, we are working with Google to try to find a workaround.
We attempt to align pageviews in GA4 with page views in Discourse. You get a page view when
You first visit the site
Within the SPA you change routes … meaning you go from one topic to another topic.
Ad blockers etc… will undo all our alignment work, given GA4 is managed via the browser calling google and our counting is done server side.
Traditional non SPA forums, will count multiple page views per topic, one for each page… we only count 1 per topic, no matter how much scrolling you do. Maybe we should re-think this… I am not sure…
Nothing out of the box, but I think there is a possibility to do so in a theme component. You would unalign Discourse page views to a degree if you did so.
Hello, for me, the problem is not completely over, it still continues. Especially from 2024, adsense is coming to a completely different ad earning system. Adsense will now pay for impressions. In this case, it will negatively affect the sites using discourse. I will be glad if you can look at this situation in the coming days