(function($) {
    $.extend(true, $.la,
    {
        modules :{
            la :{
                modules:{
                    console: {
                        modules:{
                            stats: {
                                modules: {
                                    ga: {
                                        active:true
                                    }
                                }
                            }
                        }

                    }
                }
            }
        },

        console:{
            stats:{
                ga:{
                    label: 'Google',
                    console:function() {
                        var console = '';
                        try {
                            var domain = '';
                            try {
                                domain = pageTracker.Ec().c;
                            }
                            catch(e) {
                                domain = '<span>erreur :</span> ' + e.message;
                            }
                            return $.la.console.cFormat('UA', pageTracker.s) + $.la.console.cFormat('DOMAIN', domain);
                        }
                        catch(e) {
                            if (typeof _gaq != 'undefined') {
                                var body = $('body').html();
                                var regex = new RegExp("_setAccount', '([0-9a-zA-Z\-]+)");
                                var match = regex.exec(body);
                                if (match[1]) {
                                    console += $.la.console.cFormat('Account', match[1]);
                                }

                                regex = new RegExp("_setDomainName', '([0-9a-zA-Z\-\.]+)");
                                match = regex.exec(body);
                                if (match[1]) {
                                    console += $.la.console.cFormat('DomainName', match[1]);
                                }

                                regex = new RegExp("(_trackPageLoadTime)");
                                match = regex.exec(body);
                                if (match[1]) {
                                    console += $.la.console.cFormat('trackPageLoadTime', 'Activé');
                                }
                                return console;
                            }
                            else {
                                return $.la.console.cFormat('ERROR', e.message);
                            }
                        }
                    }
                }
            }
        }
    });
})(jQuery);

