It seems like your browser didn't download the required fonts. Please revise your security settings and try again.
Barracuda Load Balancer ADC

Example - Using Response Body Rewrite to Enable Web Sites for Google Analytics

  • Last updated on

Response Body Rewrite rules apply to only HTTP and HTTPS services.

This article assumes you have a Google® Analytics™ account to obtain the code for use in the response body.

The Response Body Rewrite option provides a single point for managing response rewrites to offload Google indexing to the Barracuda Load Balancer ADC. Create rules to search and replace any string in the body of outbound responses to remove server banners or other header or body information that you do not want clients to see, to eliminate extra code in web site pages. Only responses where the content-type begins with text/ (for example: text/html, text/plain, text/javascript, text/css, text/xml) are searched; Flash and applet content are unsupported.

The search and replace strings must be text; regular expressions cannot be used.

Google Analytics Example

This procedure provides instructions for creating a Response Body Rewrite rule to offload Google indexing by inserting Google Analytics code into responses. This rule example searches for the </html> string that is on every page and then adds the Google analytics code before the string.

  1. Log into the Barracuda Load Balancer ADC as the administrator, and go to the TRAFFIC > Web Translations page.
  2. In the Response Body Rewrite section, click Add Rule
  3. In the Add Response Body Rewrite window, configure these settings:
    • Rule NameGoogle
    • Host Match *  
    • URL Match /*  
    • Search String </html>
    • Replace String :
      <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl. " : *http://www. ); document.write(unescape{"%3Cscript src="+gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</script> <script type="text/javascript"> try {var pageTracker = gatgetTracker{"UA-6605828-2");
      pageTracker._trackPageview(); } catch (err) {}</script> </body></html> 
  4. Click Save. The rule appears in the Response Body Rewrite table.