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


#1

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.


#2

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:


(Michael Downey) #3

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


#4

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