+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Excluding CMS pages from Google Analytics?

Excluding CMS pages from Google Analytics?

3 posts, 0 answered
  1. michaelroper
    michaelroper avatar
    18 posts
    Registered:
    25 Jul 2012
    10 Aug 2012
    Link to this post
    Hi all,

    I was wondering what approach anyone else uses (if any) to exclude Sitefinity backend pages+functions from affecting your Google Analytics pageviews. What I mean is - when you are editing or previewing a page in the backend, it will still load your GA code in your template, and count as a pageview. Ideally, this wouldn't happen, because it's not *really* traffic that we want to track, as we just want real visitors tracked.

    It would be good if when using the Analytics widget, it would give you the option to NOT render the GA snippet if the page is in any kind of CMS mode (editing, previewing, etc). Would there be a way to configure template settings for that widget to not render in CMS mode?

    Alternatively, there is the approach which I've used in the past, which is to do it as a filter in Google Analytics, and basically exclude all pages that end in /Action/Edit or /Action/Preview, etc... can anyone suggest a more comprehensive list of similar URLs to filter out?

    Interested to get some input on this! :)
  2. Matt
    Matt avatar
    42 posts
    Registered:
    25 Jan 2012
    18 Feb 2013 in reply to michaelroper
    Link to this post

    I would also like some input on this?  Anyone have any ideas?

  3. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    06 Dec 2016
    19 Feb 2013
    Link to this post
    Hello Matt,

    For the purpose use a master page to create template, I have used Clan.master template and its code behind  don`t render the first content placeholder where you will put the JavaScript widget with GA code (the problem is in the _gaq variable):

    protected void Page_Load(object sender, EventArgs e)
            {
                if (Page.IsDesignMode() == true)
                {
                    this.ContentPlaceHolder1.Visible = false;
                }
            }

    Make sure to add one more content placeholder to the master page:

    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
              
            </asp:ContentPlaceHolder>
               <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
              
            </asp:ContentPlaceHolder>

    To have placeholder for dragging another widgets. The placeholder where the GA code is used will not be rendered when page is in Edit mode.

    All the best,
    Stefani Tacheva
    the Telerik team
3 posts, 0 answered