Results 1 to 8 of 8

Thread: Google Analytics

  1. #1
    User
    Join Date
    06-20-10.
    Posts
    64

    Default Google Analytics

    Hi all,

    Contao was installed for us by a graphic design agency.

    They also set up their own Google Analytics script which I can see when I view the source code.

    I would like to add my own Google Analytics ID.

    Our website is not using any special module for GA, so I assume I have to edit an html file on the server but I cannot find any.

    Where exactly do I need to look?

    Thanks!

  2. #2
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: Google Analytics

    It partially depends on what version of Contao was set up for you.

    Prior to 2.9 you can change the Analytics ID in the "Page Layouts" section (each layout has its own GA ID field).

    As of 2.9, you'd need to follow the steps outlined here in the "Important Notes" section:
    http://www.contao.org/news/items/contao-2_9_RC1.html

    It's also possible it was hard-coded into the HTML template, as you've suggested. That HTML file would be located here:
    /system/modules/frontend/templates/fe_page.tpl

    Any template you wish to modify you'd copy to your "/templates/" folder and make the edits there (or "/templates/myTheme/" folder from version 2.9 on, where "myTheme" is the folder specified in the Theme settings).
    Brian

  3. #3
    User
    Join Date
    06-20-10.
    Posts
    64

    Default Re: Google Analytics

    Thanks, I found it under Templates in the CMS backend.

  4. #4
    User
    Join Date
    06-20-10.
    Posts
    64

    Default Re: Google Analytics

    Hi again,

    I have another question. I placed the Google Analytics script in the head section as required by Google.

    It's been running for two days now, and I have some statistics.

    However when I try to view which content visitors have been looking at, it simply displays a forward slash: "/"

    I guess this means the root folder.

    How come it is now showing up the individual pages that people are viewing?

    Thanks again.

  5. #5
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: Google Analytics

    Disclaimer: I'm not an huge expert.

    When you browse the site, do the URLs look like real URLs -- as though you're actually visiting different pages?

    Contao can rewrite URLs, but that may not have been set up by them.

    Make sure "Rewrite URLs" is checked in the settings. There is also an htaccess file in the root of the site that is shipped named "htaccess.txt" but needs to be renamed ".htaccess" on the server.

    Once that is done, GA should be able to recognize the different pages on the site.
    Brian

  6. #6
    User
    Join Date
    06-20-10.
    Posts
    64

    Default Re: Google Analytics

    My url's currently look like this:

    /index.php/Competition___Antitrust.html

  7. #7
    User winanscreative's Avatar
    Join Date
    06-21-09.
    Location
    Massachusetts, United States
    Posts
    261

    Default Re: Google Analytics

    Don't put your Google Analytics script in the head. Use the moo_analytics template where it gets inserted as the last item before your body tag.

    And if you have index.php in your URLs you should turn on URL Rewriting in System Settings. Like Medianomaly said, there is also an htaccess file that must be active in your root directory for those to work.

    Can you post your full GA code? I have a feeling it may be not 100% accurate as your URLs should still get tracked. Otherwise, it may only be active on your home page and not on any of your inside pages (hence only showing the root '/'). Make sure it is added to all your layouts.

  8. #8
    User
    Join Date
    01-20-11.
    Location
    Germany
    Posts
    77

    Default Re: Google Analytics

    Hello,

    Quote Originally Posted by winanscreative
    Don't put your Google Analytics script in the head. Use the moo_analytics template where it gets inserted as the last item before your body tag.
    Google recommends to insert that code in the page header and not in the footer with their new asynchronous tracking code.

    You might want to try to use the extension googleanalytics. It will create a valid code for you and offer some additional nice options. (More will be added soon. You can add new tickets here. Existing ones are only in German. I will try to describe them in English too if I find some time.)

    Jan
    Free support only here in the forum.
    Please report bugs for my extensions using http://www.contao-forge.org. Thanks!
    Requests for Contao support and development please send mail to jan@theofel.de

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •