Denis Skarbichev
Denis Skarbichev

Reputation: 176

Google analytics doesn't work for Vaadin 7 RC2

This issue is driving me crazy. I just tried to make Vaadin 7 RC2 application to be tracked by google analytics and seems I'm dead in the water.

I checked it definitely runs the following script:

 public void init(VaadinRequest request) {
        WebApplication.getInstance().logout();
        flowControllerContextLoader.load(ApplicationContextLocator.getApplicationContext());

        eventProcessor.init(ApplicationContextLocator.getWebFlowConfiguration());
        eventProcessor.run(flowController);

        applicationLayout.setCaption(Translations.APPLICATION_NAME);
        setContent(applicationLayout.getView());
        getPage().setTitle(messageSource.getMessage(Translations.APPLICATION_NAME));


        JavaScript.getCurrent().execute(
        "var _gaq = _gaq || [];\n" +
                "  _gaq.push(['_setDomainName', 'platform.lexaden.com']);\n" +
                "  _gaq.push(['_setAccount', 'ACCOUNT_INFO']);\n" +
                "  _gaq.push(['_trackPageview']);\n" +

                "\n" +
                "  (function() {\n" +
                "    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n" +
                "    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n" +
                "    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n" +
                "  })();\n");

    }

But google analytics show nothing. Could anyone please help me out?

Now hopefully it's started working. I cleaned up the cache, recompiled application once again and all widgets with Vaadin 7 RC2 and restarted server. Still not sure what's wrong - probably some conflict somewhere in cache between Vaadin 6 and Vaadin 7 applications.

Upvotes: 0

Views: 836

Answers (2)

Denis Mironov
Denis Mironov

Reputation: 11

Seems to me google analytics sometimes cannot recognize domains. As far as I understand you are tracking platform.website.com and somethingelse.website.com and it works for one of them and doesn't work for second one or vice versa.

In this case create a separate 'track' in google analytics for platform.website.com. Hope it will help.

Upvotes: 1

Nick
Nick

Reputation: 31

Have you tried using the GoogleAnalyticsTracker add-on for Vaadin? https://vaadin.com/directory#addon/googleanalyticstracker

Although the add-on's page says it's for version 6.x only, I wonder if it can actually be made work with Vaadin 7.

Upvotes: 0

Related Questions