filter · HTML filters
Insert Google Analytics (insert_ga)
- Category:
- HTML
- CoreFilters:
- No
- OptimizeForBandwidth:
- No
- Risk:
- Deprecated
Inserts the Google Analytics snippet for the account in AnalyticsID into every page. Deprecated: the snippet it inserts is the retired ga.js, and AnalyticsID itself only targets Universal Analytics, which was discontinued. Add your analytics in your templates instead.
When to use it
- Not in CoreFilters: it runs only when you enable it by name.
- Risk rating on these docs: Deprecated.
- Inserts the retired ga.js Google Analytics snippet.
Risks
The
HTML filters
page lists no specific risks for this filter.
If a page misbehaves with it, DisableFilters insert_ga turns it off for
the scope you set it in.
Configuration
Enable it in the module configuration, at server, virtual-host or location scope:
Apache
ModPagespeedEnableFilters insert_ganginx
pagespeed EnableFilters insert_ga;IIS (pagespeed.config)
pagespeed EnableFilters insert_ga
Scoping, ForbidFilters and the thresholds filters read:
Choosing filters
.
Frequently asked questions
- What does the insert_ga filter do?
- Inserts the Google Analytics snippet for the account in
AnalyticsIDinto every page. Deprecated: the snippet it inserts is the retiredga.js, andAnalyticsIDitself only targets Universal Analytics, which was discontinued. Add your analytics in your templates instead. - Is insert_ga enabled by default?
- No.
insert_gais not in CoreFilters, the default RewriteLevel; it runs only when you enable it by name withEnableFilters. - How do I enable insert_ga on Apache and nginx?
- Add
ModPagespeedEnableFilters insert_gaon Apache orpagespeed EnableFilters insert_ga;on nginx. On IIS, addpagespeed EnableFilters insert_gato pagespeed.config.
Related filters
- add_base_tag — Add base tag
- add_head — Add head
- add_ids — Add IDs
- add_instrumentation — Add instrumentation
- collapse_whitespace — Collapse whitespace
- combine_heads — Combine heads
- compute_statistics — Compute HTML statistics
- convert_meta_tags — Convert meta tags
This page is drawn from the insert_ga entry on HTML filters. Every filter in one table: PageSpeed filters.
Google Analytics, AdSense, Fonts and Hosted Libraries are Google products. We-Amp isn't affiliated with or endorsed by Google.