16

I'd love to show the Google Analytics traffic information for each page on my site EMBEDDED into that page. What's the easiest way to do this?

closed as off-topic by Sathyajith Bhat Jul 22 '13 at 3:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "It is a question about creating/developing a web application." – Sathyajith Bhat
If this question can be reworded to fit the rules in the help center, please edit the question.

9

There is no easy way to do it. Since the "flash" charts are not available to embed on to your website.

The only way you could do it is through the Google Analytics API,

See, http://code.google.com/apis/analytics/docs/

But this still won't give you charts. If you wanted charts you could use the Google Charts API in conjunction with the Google Analytics API to make your own.

See, http://code.google.com/apis/chart/

  • 2
    Wow, quite crazy that nobody else wanted to do this. I'd imagine that every user-generated-content site that uses Goog Analytics wants to do something like this (expose stats to the user base). Is there some other free Analytics package that can do this easily? Thank you! – Alex Sep 30 '10 at 19:56
  • You could look into using Mint which has widgets see, haveamint.com/peppermill and haveamint.com/peppermill/widgets – cfaulkingham Sep 30 '10 at 20:05
7

I actually ran into this same problem myself. I ended up just building my own solution and publishing it for use. OOCharts uses just one script. On top of that, you can present the charts to the public or clients. It uses Google Charts to create the charts. I also included some prebuilt solutions for anyone who doesn't want to touch the javascript objects. Here is a sample embed block for someone who wants a visit line chart:

     <script type="text/javascript" src="http://oocharts.org/release/current/oocharts.js"></script>
     <script type="text/javascript">
     oo.setPackage('corechart');
     oo.load(drawCharts);

     function drawCharts() {
        var end_date = new Date();

        var start_date = new Date();
        start_date.setDate(end_date.getDate() - 30);

        var c = new oochart("ooid", "aid", start_date, end_date, "line");
        c.setMetric('ga:visitors', 'Visits', 'number');
        c.setDimension('ga:date', 'Date', 'date');

        c.load(function(data){
            for (var i = 0; i < data.length; i++) { data[i][0] = oo.utility.parseAnalyticsDate(data[i][0]); }
            c.draw("visits_chart", data);
        });
    }
    </script>
    <div id="visits_chart"></div>

I know this is late to the question, however, this is the article I found when I was looking for answers, and would have appreciated a solution like this (minimal setup, no site registration, customizable).

Edit: OOcharts is no longer available.

Edit: Another option which might work for you is superProxy.

4

Google has sample code for this:

Visualizing Google Analytics Data with Google Chart Tools

Quote:

This article shows you how to take data from the Google Analytics Data Export API and visualize it with a variety of different graph types using the Google Charts API. This particular article is going to focus on doing it in Javascript

2

Check out embeddedanalytics. This is a service precisely for what you are asking. You define the chart (type, metrics, dimensions, date range) and then simply embed a snippet of code into your site where you want the chart to show.

Disclosure: I work with embeddedanalytics

2

Since the OP also asked if there is a similar free analytics package that allows easy embedding of charts and data, it's worth mentioning Piwik.

It's a Free software project and has pretty good documentation on embedding, seems to be exactly what the OP is looking for.

1

Disclaimer: I have no idea how to do this via code.

However, using the 'send email' report, you could send an email with your report as xml/csv/etc attachment on an automated periodic basis to a holding email account that would process it. IE, set Analytics to send the email weekly, set the mail client to automatically take emails from that sender with .xml files and upload the attachment to a holding space you could render a graph from. Then basically you just need a script to render the values from the exported report.

1

At the Google Analytics App gallery, there is a web app called SeeTheStats.

It can pull stats from your account, creates charts based on that data & it supports widgets that you can embed to show those charts on your own site.

-1

Try Explainum.

Explainum is the most easiest way to embed a chart from Google Analytics to a site. No sheets, no complicated things to setup.. Explainum connects to the data on Google Analytics, and gives a code to embed a chart to my site. The same way as youtube gives you a code to embed a video on your site.

  • The link leads to a different site at the moment. – Alex Jun 30 '13 at 18:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.