[Seaside] Setting up MixPanel and Seaside

Paul DeBruicker pdebruic at gmail.com
Sat May 12 16:24:07 UTC 2012


Without being able to see whats actually rendered its not easy to guess 
whats going wrong.  I'g guess that for the first bit you actuatlly want:

html html:'<!-- start Mixpanel --><script 
type="text/javascript">(function(d,c){var 
a,b,g,e;a=d.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===d.location.protocol?"https:":"http:")+"//api.mixpanel.com/site_media/js/api/mixpanel.2.js";b=d.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);c._i=[];c.init=function(a,d,f){var 
b=c;"undefined"!==typeof f?b=c[f]=[]:f="mixpanel";g="disable track 
track_pageview track_links track_forms register register_once unregister 
identify name_tag set_config".split(" ");
for(e=0;e<g.length;e++)(function(a){b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,0)))}})(g[e]);c._i.push([a,d,f])};window.mixpanel=c})(document,[]);
mixpanel.init("xxxxxxxxxxxxxxxxxxxxxx");</script><!-- end Mixpanel -->'.


And for the second you want:

html script (JSStream on: 'mixpanel.track("User Login");').


The 3 steps I would do are:
1. paste their code into a page and try to run mixpanel.track()
2. get seaside to insert their code into a page then manually run 
mixpanel.track() from the browser console.
3. get seaside to insert the mixpanel.track() whereever you want it.


So first make sure its loaded into your browser by manually checking in 
the page you want it to run in, then worry about getting Seaside to emit 
the necessary JS.


And its easier to help when you provide both the Smalltalk code and the 
resulting HTML that's generated in a page.




On 05/12/2012 08:49 AM, Lawrence Kellogg wrote:
> Any ideas? Perhaps, I just don't understand the Seaside Javascript
> interface.
>
> Larry
>
>
> On May 10, 2012, at 10:32 AM, Lawrence Kellogg wrote:
>
>> Hello,
>> So, I want to use MixPanel (www.mixpanel.com
>> <http://www.mixpanel.com/>) to monitor user actions in realtime. How do I
>> configure this from within Seaside?
>>
>> I am told that I have to include this:
>>
>> html script: '<!-- start Mixpanel --><script
>> type="text/javascript">(function(d,c){var
>> a,b,g,e;a=d.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===d.location.protocol?"https:":"http:")+"//api.mixpanel.com/site_media/js/api/mixpanel.2.js";b=d.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);c._i=[];c.init=function(a,d,f){var
>> b=c;"undefined"!==typeof f?b=c[f]=[]:f="mixpanel";g="disable track
>> track_pageview track_links track_forms register register_once
>> unregister identify name_tag set_config".split(" ");
>> for(e=0;e<g.length;e++)(function(a){b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,0)))}})(g[e]);c._i.push([a,d,f])};window.mixpanel=c})(document,[]);
>> mixpanel.init("xxxxxxxxxxxxxxxxxxxxxx");</script><!-- end Mixpanel -->'.
>>
>>
>> and
>>
>> html script: 'mixpanel.track("User Login");'
>>
>> The first call seems to work ok, but the second call crashes in:
>>
>> openTag
>> "Open the receiving and all associated attributes onto the document."
>>
>> self document openTag: self tag attributes: attributes closed: self
>> isClosed
>>
>> with this walk back, as document seems to be nil:
>>
>> MessageNotUnderstood 2010: No method was found for the selector
>> <#'openTag:attributes:closed:'> when sent to <nil> with arguments
>> contained in <anArray( 'script',
>> aWAHtmlAttributes('type'->'text/javascript'), false)>.
>>
>>
>> Any thoughts as to what I am doing wrong?
>>
>> Larry
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> <mailto:seaside at lists.squeakfoundation.org>
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list