this is my code in .htaccess file ... and I am sure mode_pagespeed works.
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedEnableFilters make_google_analytics_async
.
.
.
</IfModule>
and in html I add a java script code (I got it here)
<html>
<head>
<script type='text/javascript'>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
GLUE_SCRIPT
var ga = document.createElement('script');
ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
</script>
<script type="text/javascript">
try {
var pageTracker = _modpagespeed_getRewriteTracker("UA-63697801-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
</head>
<body>
</body>
</html>
what's my wrong? this is not work but for another filter insert_ga
works but that is not optimized.
You need to replace
GLUE_SCRIPT
with a function. From the Docsif you follow the example below the link provided, you can see a full implementation.