"Fossies" - the Fresh Open Source Software Archive

Member "incubator-pagespeed-mod-" (28 Feb 2020, 2724 Bytes) of package /linux/www/apache_httpd_modules/incubator-pagespeed-mod-

Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the incubator-pagespeed-mod- project site itself.

Insert Google Analytics


The 'Insert Google Analytics' filter is enabled by specifying:

ModPagespeedEnableFilters insert_ga
ModPagespeedAnalyticsID <Analytics ID>
pagespeed EnableFilters insert_ga;
pagespeed AnalyticsID <Analytics ID>;

in the configuration file. As of the default snippet is now analytics.js. To insert ga.js instead, set:

ModPagespeedUseAnalyticsJs false
pagespeed UseAnalyticsJs false;


The 'Insert Google Analytics' filter adds the basic Google Analytics javascript snippet to each HTML page. If the page already has a Google Analytics snippet inside <head> with the specified ID, then no additional snippet will be added. If another Google Analytics snippet is on the page with a different ID, then an additional snippet will be added with the ID specified in with AnalyticsID. In order to avoid any strange Google Analytics reporting, make sure that the ID specified in the configuration file matches the one used on your site.

This filter does not require the make_google_analytics_async filter. The Google Analytics snippets inserted by insert_ga are already asynchronous.

See this example of this filter in action.