Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Frederik T 242 posts 373 karma points
    Aug 12, 2011 @ 15:57
    Frederik T
    0

    Getting page views from google analytics via. xstl

    Woah, i sure am making a lot of posts, sorry for that, just working on an imense project and the firm set a crazy deadline.

    Anyway, i need to have a list of, say 5, articles (documents) that is the most viewed. I thought that it was so simple it wouldnt be a problem. But for some odd reason umbraco doesnt have anything standard to track pageviews.

    so after some searching, ive found many posts regarding this, and the answer almost always pointed at Google Analytics. Which seems to be what im looking for, but none of the posts mentioned actually HOW you use it.
    I couldnt find any relevant help or information at the plug-ins page, neither official documentation, neither did any of the forum posts mention how to use it, just that you had to. I know GA has some sort of api, but i guess thats only accesible with C# or something, and at this time i wont get access to visual studio in a long time, worse yet until AFTER the deadline.

    So how do i use GA with XSLT? It SOUNDS simple enough, but i cant find anything.

    Sorry if this is a trivial question.

  • Nigel Wilson 945 posts 2077 karma points
    Aug 12, 2011 @ 20:13
    Nigel Wilson
    0

    Hi there

    An option might be:

    1. Add a property on the respective document type called "pageViews"
    2. Create a REST extension which gets called when the page loads - this would then increment the value of the property by 1
    3. Then with XSLT you are able to easily get your articles, sort by the pageViews property and display the top 5

    Cheers

    Nigel

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 12, 2011 @ 21:06
    Dirk De Grave
    0

    @Nigel: Really, really, really bad idea, updating a document for each page load (whether only a single page or any page), you'll be hitting the db quite frequently because you need to update a property, publish the document to have the data in the cache. Even worse, all caching you've built-in will be lost as all cached macro output is invalidated for each publish.

     

    @Frederik: Go with GA. Period!

     

    Cheers,

    /Dirk

  • Nigel Wilson 945 posts 2077 karma points
    Aug 12, 2011 @ 21:28
    Nigel Wilson
    0

    Nigel thinks to himself "I think I have just been told off" as he crawls back under his rock...

    ;-)

    Good point Dirk - hadn't thought through the consequences...

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 12, 2011 @ 21:50
    Dirk De Grave
    0

    Haha, didn't mean to be soooo rude, apologies for that, I just wanted to make sure the OP didn't make the wrong decision and would complain about performance issues because of that choice.

    Anyway, we all have our bad moments :D

     

    Cheers and have a nice weekend

    /Dirk

  • Frederik T 242 posts 373 karma points
    Aug 15, 2011 @ 09:47
    Frederik T
    0

    Thank you for your reply, but my question was more HOW i use GA. As i can find zero documentation or examples of how i can get pageviews and use them, or just using any data from GA. All i get is "yes you can do it", but how?

  • Frederik T 242 posts 373 karma points
    Aug 17, 2011 @ 09:30
    Frederik T
    0

    Sorry for bumping this, but i reall need some help with this.

  • Frederik T 242 posts 373 karma points
    Aug 22, 2011 @ 09:38
    Frederik T
    0

    Again, sorry for bumping, but it seems like someone has done this before, but i cant find any sort of documentation about it and its very important i get it working.

  • Thijs 97 posts 117 karma points
    Oct 18, 2011 @ 10:39
    Thijs
    0

    I need this also in my project. Did you ever got this working?

    Thijs

  • Dan Okkels Brendstrup 101 posts 197 karma points
    Oct 18, 2011 @ 11:25
    Dan Okkels Brendstrup
    0

    Thijs, as far as I can tell there isn't an XML API for Google Analytics, but it seems like you should be able to pull it off via their Javascript API. Check out the example called "Top Pages By Pageviews" here:

    http://code.google.com/apis/analytics/docs/gdata/gdataInteractiveSamples.html

Please Sign in or register to post replies

Write your reply to:

Draft