how to add google analytics code?

anyone added the Google Analytics javascript code?
can tell how?

thanks

Comments

  • err... i see GoogleAnalyticsPlugin.php in the Plugins folder...

    Now where do i put the Tracker code(UA-24242424-1) ? and how do i Activate the plugin?

    thanks
  • ok got it from Wiki
    its working ok :)
  • For anyone looking to add Google analytics, here is the code you need to add to your config.php file:

    require_once('plugins/GoogleAnalyticsPlugin.php');
    $ga = new GoogleAnalyticsPlugin('YOUR-GOOGLE-ANALYTICS-CODE');

    As @mktw said, it is also included on the wiki: http://status.net/wiki/Plugins#Google_Analytics
  • What do I do wrong? I get this message:

    Warning: require_once(plugins/GoogleAnalyticsPlugin.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/vhosts/mysite/httpdocs/czesc/config.php on line 59

    Fatal error: require_once() [function.require]: Failed opening required 'plugins/GoogleAnalyticsPlugin.php' (include_path='.::/var/www/vhosts/mysite/httpdocs/czesc/extlib/') in /var/www/vhosts/mysite/httpdocs/czesc/config.php on line 59
  • @wthem Looks like it should be this
    require_once('plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php');
    $ga = new GoogleAnalyticsPlugin('YOUR-GOOGLE-ANALYTICS-CODE');
  • @jordanc thanks!!! i must have got an brain eclipse :-))
  • @mktw @jordanc @wthem

    The easiest is:

    addPlugin('GoogleAnalytics', array('code' => 'UA-24242424-1'));
  • @mktw @AdamD @jordanc @vvver

    all i have tried add code to my index.php. but cant work for me. still show that i havent installed the google analytics code. pls tell me how to do it in detail. thanks

    msn: flyskybd06@hotmail.com.
  • @gjh592970101

    No, you don't edit index.php. You edit config.php and add the following code:

    [code]
    require_once('plugins/GoogleAnalytics/GoogleAnalyticsPlugin.php');
    $ga = new GoogleAnalyticsPlugin('YOUR-GOOGLE-ANALYTICS-CODE');
    [/code]

    Be sure to replace the all-caps part with your google analytics code.

    Also, I believe Google's terms require a notice on the site that you are using GA. You'll have to check Google's site to determine exactly what their requirements are.
  • @Inxwalt
    but there is not config.php. just have dt-config.php in config file.
  • @gjh592970101: You should have either a config.php.sample or config.php in the root of your StatusNet installation. You need to add the code of @lnxwalt above to the config.php-File. If you don't have this file, copy and rename config.php.sample to config.php and edit this one.
  • @habi:
    StatusNet installation?? is my website related with statusnet?
  • @gjh592970101 This forum here is *only* for questions related to StatusNet. If you've got troubles with another software you have to ask those developers...
  • @habi
    oh, i see now. thanks. BTW, i have done it. my website is related ga now. thanks all.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID