[Opa] Google Analytics

Matthieu Guffroy mattgu74 at gmail.com
Wed Oct 19 09:19:06 EDT 2011


An other way to do that is to use Resource.full_page to personnalise the
header.

An example is here :
https://github.com/mattgu74/SkiUTC/blob/master/src/pages/render.opa
Line 102 function public(page)


An other example is in the opacms (using the way explained by Adam)
https://github.com/mattgu74/OpaCms/blob/master/src/main.opa
Line 24 the google code is here
Line 48 add the resource parser
Line 53 the function wich force the call of js code.


--
Matthieu GUFFROY


2011/10/19 Adam Koprowski <Adam.Koprowski at mlstate.com>

>   Dear Tim,
>
>   Quick & dirty approach: put this script in a separate .js file, make it
> available as an application external resource<http://blog.opalang.org/2011/07/image-part-1-dealing-with-external.html> and
> use it with a standard <script> tag.
>
>   A better way to do that would be to interface this functionality via an
> Opa plugin <http://doc.opalang.org/#_bindings_with_other_languages>, that
> could then be made available to the community, or maybe even included in the
> standard library (in stdlib.api).
>
>    Hope that helps,
>    Adam
>
>
> On Tue, Oct 18, 2011 at 19:25, Tim Cotten <tcotten at bigi.co> wrote:
>
>> Hi all,
>>
>> Does anyone have any idea how to embed the Google Analytics JS code in
>> each page being served?
>>
>> For reference:
>>
>> <script type="text/javascript">
>>
>>   var _gaq = _gaq || [];
>>   _gaq.push(['_setAccount', 'ACCOUNTIDHERE']);
>>   _gaq.push(['_trackPageview']);
>>
>>   (function() {
>>     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>
>>
>> _______________________________________________
>> Opa mailing list
>> Opa at lists.owasp.org
>> https://lists.owasp.org/mailman/listinfo/opa
>>
>>
>
>
> --
> *Adam Koprowski                [http://adam-koprowski.net]
> Opa Tech Evangelist @ MLstate [http://opalang.org | http://mlstate.com]*
>
> _______________________________________________
> 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/20111019/c7b4dcfb/attachment.html 


More information about the Opa mailing list