Try Now
More in this section

Forums / Developing with Sitefinity / Google analytics not appearing to detect clicks on image rotator

Google analytics not appearing to detect clicks on image rotator

2 posts, 0 answered
  1. Charles
    Charles avatar
    61 posts
    18 Jul 2012
    18 Jan 2012
    Link to this post
    I have a website (www.xxxx.com) where I can see the in-page analytics. I see that there are clicks on the page in the top menu, bottem contact etc, but there is an image rotator in the middle of the page that doesn't appear to be getting detected. I clicked on this website a few times on that banner but still nothing is coming up. The link that the click launches is a different website (www.yyyy.com).

    Any ideas why there are no clicks showing for the image rotator?
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    24 Oct 2016
    21 Jan 2012
    Link to this post
    Hi Charles,

    For Google Analytics to be able to track the clicks on your images/links you'll need to add a client-side handler for the click event that will sent the click to GA. What you can do in this case would be to use jQuery and then the document is loaded you can get all <a> or <img> tags which have links to items from libraries using the attribute contains selector. Then you can modify all elements in the collection to add the GA tracking code.
    In the image rotator class you can use jQuery selector  to select all children of your rotator class who have <img> tags and bind them to your click handler. For example:
    $(document).ready(function () {
        $('.Class').find('img').bind('click', function () {
            _gaq.push(['_trackPageview', this.href]);
    The other option is to create an override of the Generic Cotnent control using this blog post and KB article as guidance. Then in the PreRender event you can get all links from the content about to be rendered and apply the same logic, however using server side code.

    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered