All of the examples I have seen are hard coded. Like:
mixpanel.people.identify("12148");
How do I replace the 12148 with a value from the server side?
Just thought of an even better way. Use StringBuilder and RegisterStartupScript.
Dim User As New UserViewModel(Utilities.CurrentUserID)
Dim strMixCommand As New System.Text.Stringbuilder()
strMixCommand.Append("mixpanel.track('XXXXXX.aspx Page Loaded');")
strMixCommand.Append("mixpanel.people.identify(" & User.UserID & ");"
strMixCommand.Append("mixpanel.people.set({ 'UserID':'" & User.UserID & "',"
strMixCommand.Append("'UserType':'Borrower',"
strMixCommand.Append("'$created':new Date(),"
strMixCommand.Append("'$last_login':new Date(),"
strMixCommand.Append("'$email':'" & User.Email.ToString() & "',"
strMixCommand.Append("'First Name':'" & User.FirstName.ToString() & "',"
strMixCommand.Append("'Last Name':'" & User.LastName.ToString() & "',"
strMixCommand.Append("'Member Since':'" & User.CreatedDate.ToString() & "'})"
Dim strScript As String = "<script type=""text/javascript"" language=""javascript"">" & strMixCommand & "</script>"
Me.ClientScript.RegisterStartupScript(Me.GetType, "Script", strScript)
If this was run on page load, this would generate the JavaScript on the server side, pre-populated with the desired data from the database, without the intermediate step of populating hidden fields, or having any mixpanel code in the front-end at all...