Embed Request: Option to NOT Load Google Analytics or Other Unnecessary Scripts in the Embedded iFrame JS

AI-generated summary

Request for Embed Option: A user is requesting an option to prevent the loading of Google Analytics and other unnecessary scripts in the embedded iFrame JS, citing issues with double-loading of resources and potential double-counting of statistics. This is a problem when embedding a Discourse forum into a blog as comments.

Berto proposes an “bare bones” embed option to save bandwidth and requests. Currently, using the official Google Analytics options in Discourse results in duplicate script calls when embedding the forum.

Berto also mentions issues with Google Tag Manager’s JS being downloaded multiple times, despite not being set up in Discourse. Downey agrees on the importance of this issue and asks about the feasibility of a fix.

Continuing the discussion from Embedding Discourse Comments via Javascript,

I noticed that when embedding my Discourse Forum (which has been configured with Google Analytics via the Admin fields) into my Blog as blog comments, it was loading Google Analytics JS files twice – once from the blog’s calls, once from the Embed’s calls.

This then added more resources to be downloaded on the calling site, and could double your statistics across your entire business.

There should be an option to not load Analytics and potentially any other unnecessary scripts to save bandwidth/requests on the site embedding Discourse. Embed should be more bare bones IMHO.

The current workaround is to stop using the official Google Analytics options and just put the call into your forum’s head. Then it’s not called in the embed.

3 лайка

Addendum,

Even with my workaround, I’m still getting multiple downloads of Google Tag Manager’s JS, one for the blog, one for the embedded JS.

Some people may want this one, but I don’t. Not sure how to disable since I’ve never set it up in Discourse in the first place. :sadpanda:

1 лайк

This seems pretty important due to the double-counting problem. Does anyone know if it would be a difficult fix?

Thanks for your interest!

If you want to verify, check it out in Pingdom Tools on a site that’s using the embed. That’s what I’m using (Pingdom Tools), but it’s tough bouncing back and forth between modes and clearing blog’s cache