Search code examples
roku

Set Session Cookie


I am trying to store a session cookie for google analytics

This is the code

if valid(m.GATracker.Cookie) then
    print "Cookie:"; m.GATracker.Cookie
else
    m.GATracker.Cookie = 'Random Cookie Number
end if

every time I hit the function with this code a new cookie is generated. I thought m. was how you stored variables


Solution

  • Well that depends on where this code comes from. You need to paste a bigger segment.

    In a global function, m is the same as getGlobalAA() - but inside a method (that is "a function belonging to a dictionary" in brightscript), m actually points to the object itself (i.e. this or self equivalent).