More in this section
Forums / General Discussions / Google Analytics to track downloads

Google Analytics to track downloads

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
4 posts, 0 answered
  1. Jason
    Jason avatar
    16 posts
    27 Aug 2008
    20 Jan 2011
    Link to this post

    I need to have google analytics track document download stats.  In the past I believe I found a forum post that provided instructions for getting version 3.x to do so however I'm now going to be running version 4 so I'm looking on some guidance on how I'd go about enabling this.  I know that I can tag links individually but its the document library that is my main concern.

  2. Hristo Borisov
    Hristo Borisov avatar
    190 posts
    03 Jul 2018
    25 Jan 2011
    Link to this post
    Hello Jason,

    It is possible to include the necessary code for the Google Analytics tracking by editing the template of your document list widget. To do that create a Sitefinity web page and drop the Download list widget somewhere on the page. After that click on the Edit-> Settings->Edit Thumbnail List Templates and choose the template you are currently using. For example if you are using the List you have to edit the Documents - list template. In the ItemTemplate you can simply add the link reference with the necessary code to track Google Analytics.

    Here is the edited template that I created in order to implement your scenario:

    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
    <sf:BrowseAndEditToolbar ID="browseAndEditToolbar" runat="server" Mode="Edit"></sf:BrowseAndEditToolbar>
    <div id="itemsContainer" runat="server">
        <asp:Repeater ID="documentsRepeater" runat="server">
                <ul class="sfdownloadList sfListMode">
                <li id="docItem" runat="server" class="sfdownloadFile">
    <a href="<%# Eval("MediaUrl")%>"  runat="server"  title="Download" target="_blank" onClick="javascript: _gaq.push(['_trackPageview', '/downloads/<%# Eval("Title")%>']);"><%# Eval("Title")%></a>
                    <sitefinity:SitefinityLabel id="infoLabel" runat="server" WrapperTagName="div" HideIfNoText="false" CssClass="sfInfo" />
    <sitefinity:Pager id="pager" runat="server"></sitefinity:Pager>

    I have manually included the link tag with the necessary code from google that is explained in their How do I track files document.

    Note that in order to properly execute the code you will also need the Google Tracking code that will insert the needed to properly execute the onClick function above.

    Please let me know whether you have any further questions.

    Kind regards,
    Hristo Borisov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Brooke
    Brooke avatar
    1 posts
    07 Dec 2010
    16 Feb 2011
    Link to this post
    Could you point me in the right direction for implementing this on 3.x? I searched, but could not find the post you mentioned. I understand how this works in GA, just don't know how to implement without doing it manually for each link.

    Thank you!
  4. Georgi
    Georgi avatar
    3583 posts
    28 Oct 2016
4 posts, 0 answered