Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Namespace GoogleAnalyticsCtrl
<DefaultProperty("uacct")> _
<ToolboxData("<{0}:GoogleAnalytics runat=server></{0}:GoogleAnalytics>")> _
Public Class GoogleAnalytics
Inherits WebControl
Protected Overrides Sub OnInit(ByVal e As EventArgs)
Me.EnableViewState = False
MyBase.OnInit(e)
End Sub
Private m_uacct As String = "UA-"
<Bindable(True)> _
<Category("Appearance")> _
<DefaultValue("")> _
<Localizable(True)> _
Public Property uacct() As String
Get
Return m_uacct
End Get
Set(ByVal value As String)
m_uacct = value
End Set
End Property
Private m_DebugMode As [Boolean] = False
<Bindable(True)> _
<Category("Appearance")> _
<DefaultValue("true")> _
<Localizable(True)> _
Public Property DebugMode() As [Boolean]
Get
Return m_DebugMode
End Get
Set(ByVal value As [Boolean])
m_DebugMode = value
End Set
End Property
Protected Overrides Sub RenderContents(ByVal output As HtmlTextWriter)
If DebugMode Then
Return
End If
Dim sScript As String = "<script src=""http://www.google-analytics.com/urchin.js"" type=""text/javascript"">" & vbCr & vbLf & "</script>" & vbCr & vbLf & "<script type=""text/javascript"">" & vbCr & vbLf & "_uacct = """ & uacct & """;" & vbCr & vbLf & "urchinTracker();" & vbCr & vbLf & "</script>"
output.Write(sScript)
End Sub
End Class
End Namespace
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE