Yii 1.1: google-analytics

Widget for including GA counter code to your site

Usage ΒΆ

1) Place EGoogleAnalyticsWidget.php to your_project_dir/protected/extensions/widgets/googleAnalytics/EGoogleAnalyticsWidget.php or any other directory that is convenient for you.

2) Use: Add to your layout file:


Where 'WW-DDDDDDD-DD' is your site id in GA, 'ext.widgets.googleAnalytics.EGoogleAnalyticsWidget' is a path alias to EGoogleAnalyticsWidget.php and '.example.com' is your domain (if you place a dot before domain name, subdomains will included in reports of Google Analytics)

Also you can specify additional search systems for GA as 'searchSystems' widget parameter, that must contain array, where keys is corresponding to search system domain names and values equals search system query parameter.

For example:


By default some additional russian & ukrainian search systems is added. If you don't need this, just set 'searchSystems'=>array()

Total 5 comments

#12750 report it
dty at 2013/04/09 05:57pm
is this needed?

cant we just include the code ourselves in our main layout? or am I missing something?

#8351 report it
pckabeer at 2012/05/28 08:57am
re :layout or main file?

Hi jechen3,

Add it to the main.php layout file , thus it will show up in alll other pages.

#7721 report it
jcny at 2012/04/11 11:23am
layout or main file?

Hi, when you say to add this to the layout file, do you mean the main.php layout file, or each of the column layout files? You don't need to add this to individual view pages?

Also, does it matter where the endwidget is placed? Thanks, this extension is exactly what I was looking for!

#2648 report it
Nayjest at 2011/01/25 04:16am
re: eCommerce

Hi, pentium10 No, this widget don't have eCommerce capabilities. But I am planning to implement it in further time.

Also if you will use this widget and implement eCommerce capabilities, you can send me a patch.

#2632 report it
Pentium10 at 2011/01/24 07:31am

Does it have eCommerce capabilities?

Leave a comment

Please to leave your comment.

Create extension