[Opa] Including google analytics with resource
Frederic Ye
frederic.ye at mlstate.com
Sun Nov 6 10:03:15 EST 2011
You can put it "anywhere".
But make sur to include it only once in your source code.
I recommend you to put it before launching the server for example.
What is the compilation error?
On 6 nov. 2011, at 15:59, Tristan Sloughter wrote:
> Thanks, this looks like exactly what I want, but I can't see where to actually place it in the flow of the module. It looks like you put it after the url function and before setting up the server but I didn't think that would work and it didn't compile.
>
> Tristan
>
> On Sun, Nov 6, 2011 at 8:46 AM, Frederic Ye <frederic.ye at mlstate.com> wrote:
> Hello,
>
> A way to include a JS on every page (at the end) :
>
> http://doc.opalang.org/new_doc/#stdlib.core.web.resource.resource.opa.html/!/value_stdlib.core.web.resource.Resource.register_external_js
>
> On 6 nov. 2011, at 15:39, Tristan Sloughter wrote:
>
>> I know there are some answers out there on how to do this but they look like they require me to change a lot of how I already have my app setup... So I was wondering if there was a simpel way to "append" the google analytics script to a resource. My main module is below, I have the google analytics <script> in a xmlt file that I set to the variable footer, but not sure how (or if its possible) to somehow include that in each returned resource from urls.
>>
>> Thanks.
>>
>> footer = @static_content("google_analytics.xmlt")
>>
>> urls : Parser.general_parser(http_request -> resource) =
>> parser
>> | {Rule.debug_parse_string(s -> Log.notice("URL",s))} Rule.fail -> error("")
>> | "/todos" result={Todo.resource} -> result
>> | "/user" result={User.resource} -> result
>> | "/login" result={User.resource} -> result
>> | "/admin" result={Admin.resource} -> result
>> | (.*) result={Todo.resource} -> result
>
> do Resource.register_external_js("/resources/js/google_analytics.js")
>
>>
>> server = Server.of_bundle([@static_resource_directory("resources")])
>> server = Server.make(urls)
>> _______________________________________________
>> Opa mailing list
>> Opa at lists.owasp.org
>> https://lists.owasp.org/mailman/listinfo/opa
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.owasp.org/pipermail/opa/attachments/20111106/c4bc3676/attachment.html
More information about the Opa
mailing list