1

We have implemented the Fooman Google Analytics Plus module. The UA tag seems to working properly when checking it with Google's tag chrome plugin. However, it's not tracking subdirectories properly.

The way our Magento site works we have each store view under a subdirectory so ourdomain.com/us_en/ would be United States and ourdomain.com/dk_da/ would be Denmark etc. etc. When I go to the page source and look at what it's sending to Google Analytics, it's not recording the /us_en/ or /dk_da/ or any of the other country subdirectory page views. However, anything that comes after the store view directory...works fine. I have no idea why. In Google Analytics it's showing the same. If I go to All website data and look at Landing pages I see /news/product/something/something/something....but the country code isn't listed first.

We have a ton of views set up with filters to include only a certain subdirectory like /us_en/ but it doesn't work at all for the reasons mentioned above.

Example: Going to ourdomain.com/us_en/ returns this:

  <!-- Google Analytics -->
<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UAcoderemovedforexample','auto');

                    ga('send', 'pageview', '');

</script>
    <!-- End Google Analytics -->

Going to ourdomain.com/us_en/ambassadors and viewing source returns this:

    <!-- Google Analytics -->
<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UAcoderemovedforexample','auto');

                    ga('send', 'pageview', '/ambassadors');

Going to our homepage without any subdirectory returns this which is the same as if we used a subdirectory.:

 <!-- Google Analytics -->
<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UAcoderemovedforexample','auto');

                    ga('send', 'pageview', '');

As you can see...it's skipping the /us_en/ subdirectory. To give more insight on how our site works is that when you come to it the first time it asks you your country with a lightbox and then remembers you for future visits (so it auto redirects to the proper store view/subdirectory). Inside of Magento the base URL is set to ourdomain.com across the board.

I'm sure there will be more questions. Any help is appreciated!

0

The url to be tracked is normalised using the store's base url. It sounds like your subfolder configuration happens outside of Magento. For our extension to include this you would need to have your base urls set up like ourdomain.com/dk_da/ and ourdomain.com/us_en/.

The relevant code for this would be here and you might be able to delete the mentions of Mage::app()->getRequest()->getBaseUrl() .

  • So we're thinking if we delete mentions of that getbaseURL reference, your module should still work with our current setup? I just wouldn't want to go through the hassle of adjusting setup if we can change the module =D. Thanks for the quick response! Bonus points. – Zach May 28 '15 at 23:44
  • It should - however I do not have personal experience with how you have set this up so would suggest you trial out the deletion on your testing/staging/dev environment. – Kristof at Fooman May 29 '15 at 8:30
  • Hey Fooman. So now we've made the adjustments. One thing we've found is it's not carrying through to our checkout at all correctly. Transactions don't add up to what we show inside of Magento. In addition, when I get to the order success page and run a view source I see "checkout/cart" showing for the page view instead of checkout/onepage/success. Very peculiar. Any thoughts? – Zach Jun 12 '15 at 1:18
  • viewing the source html is sometimes interpreted by the browser as separate page load (like a page reload) - since the checkout success page is only displayed once you are redirected to the empty cart page. Try saving the page or using firebug to see what is sent across. – Kristof at Fooman Jun 12 '15 at 3:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.