Forum Discussion
HELITG_35878
Nimbostratus
Aug 18, 2008Google Analytics
I've found an article has a iRule to handle Google Analytics
http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=174
I wanted to modify the ...
HELITG_35878
Nimbostratus
Aug 18, 2008Thanks for the reply. We have an LTM 1500
Here is the error when I try to save the iRule.
01070151:3: Rule [ir_Google_Analytics] error: line 4: [command is not valid in the current scope] [when RULE_INIT { replace the value of the _uacct variable with your Google Analytics account. set analytics !-- Begin Analytics --script src=http://www.google-analytics.com/urchin.js type=text/javascript/script script type=text/javascript uacct = UA-edited-1 urchinTracker /script !-- End Analytics -- set exist_search urchinTracker }] line 16: [command is not valid in the current scope] [when HTTP_REQUEST { Dont allow data to be chunked if { [HTTP::version] eq 1.1 } { if { [HTTP::header is_keepalive] } { HTTP::header replace Connection Keep-Alive } HTTP::version 1.0 } }] line 25: [command is not valid in the current scope] [when HTTP_RESPONSE { if { [HTTP::header Content-Type] starts_with text/html } { if { [HTTP::header exists Content-Length] } { log local0. content length: [HTTP::header {Content-Length}] set content_length [HTTP::header Content-Length] } else { set content_length 1000000000 } log local0. Collecting $content_length bytes if { $content_length 0 } { HTTP::collect $content_length } } }] line 39: [command is not valid in the current scope] [when HTTP_RESPONSE_DATA { log local0. Content Type: [HTTP::header Content-Type] if { ! [HTTP::payload] contains $::exist_search } { log local0. Payload didnt contain $::exist_search! set idx [string last /body [HTTP::payload]] if { -1 == $idx } { set idx [string last /BODY [HTTP::payload]] } log local0. html end tag found at $idx if { -1 == $idx } { set offset [HTTP::payload length] } else { set offset $idx } HTTP::payload replace $offset 0 $::analytics } }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects