• Not Answered

Media File Downloads Not Counted

Enterprise 3.1 / Community 6.1

Just noticed that when displaying the Media Gallery Post page for a specific post that if you click the Download File link in the "Media Gallery - Links" widget that the download is counted. However, clicking on the Download button or the file name link in the "Media Gallery - File" widget will not be counted. The "Links" widget uses the "/postID/download.aspx" URL while the "File" widget provides a direct link to the file, bypassing the download script, which I expect is doing the count recording.

The links in the "File" widget appear to be rendered by the "$core_v2_ui.GetViewHtml" method or the $core_v2_ui.GetPreviewHtml method, which puts the fix out of my hands.

Am I reading the correctly? Is there a fix?

6 Replies

  • Hi Bill,

    Which build of Community 6.1 are you using? For example, 6.1.16.34278.

    I tested on my local setup of version 6.1.16. I believe this is what you are talking about:

    When I click the #2 link, it increments the download count as in your case. When I click the #1 link or button to the left, it also increments the download count. Both links point to the same url for me: http://community6.1.16.34278/all_about_chocolate/m/mediagallery/2/download.aspx

    For my widgets, both of the urls are generated via $core_v2_mediaUrls.DownloadMedia($media.Id)

    Regards,
    Zac Elsik

  • In reply to Zac Elsik:

    Zac,

       I'm on Platform version: 6.1.10.31252, Enterprise 3.1.10.31252. I know we are a bit behind on patches, so there may be something there although I did see anything. Where I am thinking the issue may be coming from is the Document Preview plug-in. But I am not sure about that. In fact I get the same behavior where the file in the gallery cam be previewed or not. 

    The "Download file" link at the top is counted, clicking the image is counted, but clicking the file name below the image will not be counted. Not all files can be clicked on as this image can. So it is really about the link displayed with the file. 

    I am thinking that this widget has changed in a patch or the file preview plug-in changed it. 

    Bill

  • In reply to Bill Corley:

    Hi Bill,

    Thanks for the additional information. I'm having our Product Development team take a look into this one.

    Do you know if your site theme, widgets, or other parts of the site related to this have had any customizations done to them?

    I'm wondering if that link below the image is a link generated by the Doc Preview, which could be working separately and, when clicked, not properly incrementing the download count.

    Zac

  • In reply to Zac Elsik:

    Sorry for the delayed response. Family emergency. I believe this particular widget is the standard coding although it is unclear to me what changes may have been made to it when the document preview plugin was installed.

  • In reply to Bill Corley:

    Hi Bill,

    This appears to be a bug specific to the Enterprise theme.  To fix this, you'll need to modify the Media Gallery - File widget (make sure to edit the Enterprise theme version, not the factory default, it's a drop-down box you have to select from). Around line 77, replace:

    #if ($mediaType != 'Image')
    <a href="$core_v2_encoding.HtmlAttributeEncode($media.File.FileUrl)" class="internal-link download-attachment button">
    <span></span>$core_v2_language.GetResource('MediaGalleries_Button_Download')
    </a>
    #end

    with:

    #if ($mediaType != 'Image')
    <a href="$core_v2_encoding.HtmlAttributeEncode($core_v2_mediaUrls.DownloadMedia($media.Id, false))" class="internal-link download-attachment button">
    <span></span>$core_v2_language.GetResource('MediaGalleries_Button_Download')
    </a>
    #end

    Please let me know if you have any questions.

    Zac

  • In reply to Zac Elsik:

    This does resolve one issue that I hadn't even mentioned. This fixes the URL for the download button that is displayed if the file is not an image file. And that was an issue. But there is a link that is being displayed under the file preview that is still wrong. In my previous post with an image, note the link under the image "1china_3033.jpg". That is a link that is independent of the download button which your recommended change fixed. This is the link that I was originally needing fixed.

    This link appears to be generated in the block of code just above your recommended fix.

    #if ($mediaType == "Video")
    $!core_v2_ui.GetViewHtml($media.File.FileUrl)
    #elseif ($mediaType == "Audio")
    $!core_v2_ui.GetViewHtml($media.File.FileUrl, "%{Width = 325}")
    #elseif ($mediaType == "Image")
    <a href="$core_v2_encoding.HtmlAttributeEncode($core_v2_mediaUrls.DownloadMedia($media.Id, false))" class="internal-link download-attachment image">
    $!core_v2_ui.GetViewHtml($media.File.FileUrl)
    </a>
    #else
    <a href="$core_v2_encoding.HtmlAttributeEncode($core_v2_mediaUrls.DownloadMedia($media.Id, false))" class="internal-link download-attachment">
    $!core_v2_ui.GetPreviewHtml($media.File.FileUrl, "%{Width = 65, Height = 65}")
    </a>
    #end

    The GetViewHtml or GetPreviewHtml seems to be creating the view/preview of the file as well as including a link to the file below the preview. It is not clear to me how that link is being included. Can you look at that?

    Thanks for your assistance!

    Bill

Related