Huh, now I have no idea where I read about utmvid, it doesn't seem to be working as desired. I took a look and just about everything is showing up as non-unique. Here's hoping that the new GA Measurement Protocol is easier to use...
I've never used the MO stuff RokuChris linked to, that could work. I also found a pretty good explanation of the cookie parameters at
http://www.tutkiun.com/2011/04/a-google-analytics-cookie-explained.html. Using that as a guide, things seem to work if I use the registry to keep track of things. Something like this (using a RegRead helper that takes a default value if the key doesn't exist... you get the idea):
' Initialize our "cookies"
domainHash = "1234567890" ' Change this, should be unique for the domain (usually set by google)
visitorID = RegRead("AnalyticsID", "analytics", invalid)
if visitorID = invalid then
visitorID = GARandNumber(1000000000,9999999999).ToStr()
RegWrite("AnalyticsID", visitorID, "analytics")
end if
timestamp = CreateObject("roDateTime")
firstTimestamp = RegRead("FirstTimestamp", "analytics", invalid)
prevTimestamp = RegRead("PrevTimestamp", "analytics", invalid)
curTimestamp = timestamp.asSeconds().ToStr()
RegWrite("PrevTimestamp", curTimestamp, "analytics")
if prevTimestamp = invalid then prevTimestamp = curTimestamp
if firstTimestamp = invalid then
RegWrite("FirstTimestamp", curTimestamp, "analytics")
firstTimestamp = curTimestamp
end if
numSessions = RegRead("NumSessions", "analytics", "0").toint() + 1
RegWrite("NumSessions", numSessions.ToStr(), "analytics")
url = url + "&utmcc=__utma%3D" + domainHash + "." + visitorID + "." + firstTimestamp + "." + prevTimestamp + "." + curTimestamp + "." + numSessions.tostr()
url = url + "%3B%2B__utmb%3D" + domainHash + ".0.10." + curTimestamp + "000"
url = url + "%3B%2B__utmc%3D" + domainHash + ".0.10." + curTimestamp + "000"
I'm only using events, not pageviews, so I'm not worrying about the .0 value in the utmb/utmc cookies. I'm not sure if you'll want to increment that on each request. Good luck. :]