Forum Discussion
Ken_Chan_95249
Nimbostratus
Jan 07, 2010Add google analytics code to payload
Hi all,
I want to add the google analytics code to payload by irules and I have created the following ..
when HTTP_RESPONSE {
set clen [HTTP::header Content-Le...
hoolio
Cirrostratus
Jan 07, 2010Hi Ken,
That's a good start. You could take the second example on the HTTP::collect wiki page (Click here and add a check to see that the response content type contains "text" (or other relevant content-types for you):
if {[HTTP::header "Content-Length"] contains "text" && \
[HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] <= 1048576}{
In HTTP_REQUEST_DATA, you could then insert the Google Javascript using:
HTTP::payload replace 0 0 $new_payload
The first digit is the offset. 0 starts the insertion at the beginning. The second digit is the length of the string to replace. 0 replaces nothing.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
