Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Google Analytics.
Fri, Mar 6 2015 6:44 PMPermanent Link

Steve Gill

Avatar

Has anyone successfully added Google Analytics code to their EWB apps?

= Steve
Sun, Mar 8 2015 6:39 AMPermanent Link

Matthew Jones

Steve Gill wrote:

> Has anyone successfully added Google Analytics code to their EWB apps?

Not me. Look forward to your report on how to do it. 8-)

--

Matthew Jones
Tue, Mar 10 2015 10:55 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Steve,

<< Has anyone successfully added Google Analytics code to their EWB apps? >>

The TScript component is the ticket.  Just load the GA script dynamically
using it (be sure to pay attention to the https/http part of the URL
property), and in the OnLoad event handler for the script, go ahead and
manipulate the GA objects as needed.

Attached it the classic GA external interface unit.  You'll have to add the
new universal GA interface, if that's what you want to use.

You would use it like this:

unit Unit1;

interface

uses WebCore, WebForms, WebCtrls;

type

  TForm1 = class(TForm)
     Script1: TScript;
     procedure Script1Load(Sender: TObject);
     procedure Form1Show(Sender: TObject);
  private
     { Private declarations }
  public
     { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses GAInterface, WebHTTP;

procedure TForm1.Script1Load(Sender: TObject);
var
  TempTracker: TGAPageTracker;
begin
  try
     TempTracker:=_gat._getTracker('UA-15048886-1');
     TempTracker._trackPageview;
     LogOutput('Consider this application tracked');
  except
  end;
end;

procedure TForm1.Form1Show(Sender: TObject);
begin
  Script1.URL:='http://www.google-analytics.com/ga.js';
end;

end.

Of course, be sure to remove the LogOutput() call for production usage, and
please don't keep using our tracking ID. Smile

Tim Young
Elevate Software
www.elevatesoft.com





Attachments: GAInterface.wbs
Tue, Mar 10 2015 4:27 PMPermanent Link

Steve Gill

Avatar

<<  Of course, be sure to remove the LogOutput() call for production usage, and
please don't keep using our tracking ID. Smile >>

Ha ha.  That's awesome - thanks Tim.

= Steve


Image