Try now Demo en
  • en
  • fr
  • de
  • Solutions
    • Use cases
      • Modern IntranetBuild strong internal culture & sense of belonging
      • Collaboration PlatformEfficient teamwork and project collaboration
      • Social NetworkEngage users & recognize contributions
      • Knowledge hubCentralize, organize and share company knowledge
      • Application PortalUnified access to business applications and information
    • Switch to eXo
      • Microsoft 365 AlternativeAn open-source digital workplace alternative to M365
      • Migrate to eXo PlatformA guided, secure migration path from your existing tools to eXo
  • Product
    • Overview
      • Platform overviewExplore core capabilities
      • Why eXoKey differentiators
      • InternationalisationMultilingual environments
      • MobileBranded mobile applications
    • Platform
      • No CodeTailor to your needs without code
      • IntegrationsConnectors & extension capabilities
      • Controlled AIGoverned, extensible AI
    • Technology
      • ArchitectureArchitecture & technology
      • SecuritySecurity measures
      • Open sourceComponents & licensing
  • Offers
    • EnterprisePrivate cloud or on-premise deployments
    • eXo HubsReady-to-use SaaS edition for teams
    • Compare EditionsCompare editions and choose the right fit
    • OEM EditionFor software vendors & service providers
    • ServicesDiscover eXo professional services
  • Resources
    • Resource center
      • Case studies
      • White Papers
      • Datasheets
      • Videos
    • FAQsAbout the software, the community and our offers
      • Platform & Use Cases
      • AI & Responsible AI
      • Deployment, Security & Compliance
      • Open-source, Pricing & Services
    • From The Blog
      • eXo Platform 7.1 is released
      • Digital sovereignty: when public organizations move from words to action
      • Cloud Vs On-premise Digital Workplace: Which one is right for your business?
  • Community
    • CommunityJoin our online community platform
    • DownloadLaunch eXo platform in your infrastructure
    • Source codeSource code on github
    • REST APIs & DocumentationAll REST APIs available in eXo Platform
  • Company
    • About us
    • Customers
    • Partners
    • Contact us
    • Newsroom
  • Menu mobile
    • Enterprise Offers
    • Blog
    • About us
    • Resource center
    • Careers
    • Contact us
    • Try eXo
Use cases
  • Modern Intranet Build strong internal culture & sense of belonging
  • Collaboration Platform Efficient teamwork and project collaboration
  • Social Network Engage users & recognize contributions
  • Knowledge hub Centralize, organize and share company knowledge
  • Application Portal Unified access to business applications and information
Switch to eXo
  • Microsoft 365 Alternative An open-source digital workplace alternative to M365
  • Migrate to eXo Platform A guided, secure migration path from your existing tools to eXo
Overview
  • Platform overview Explore core capabilities
  • Why eXo Key differentiators
  • Internationalisation Multilingual environments
  • Mobile Branded mobile applications
Platform
  • No Code Tailor to your needs without code
  • Integrations Connectors & extension capabilities
  • Controlled AI Governed, extensible AI
Technology
  • Architecture Architecture & technology
  • Security Security measures
  • Open source Components & licensing
Enterprise Private cloud or on-premise deployments
eXo Hubs Ready-to-use SaaS edition for teams
Compare Editions Compare editions and choose the right fit
OEM Edition For software vendors & service providers
Services Discover eXo professional services
Resource center
  • Case studies
  • White Papers
  • Datasheets
  • Videos
FAQs About the software, the community and our offers
  • Platform & Use Cases
  • AI & Responsible AI
  • Deployment, Security & Compliance
  • Open-source, Pricing & Services
From The Blog
  • eXo Platform 7.1 is released
  • Digital sovereignty: when public organizations move from words to action
  • Cloud Vs On-premise Digital Workplace: Which one is right for your business?
Community Join our online community platform
Download Launch eXo platform in your infrastructure
Source code Source code on github
REST APIs & Documentation All REST APIs available in eXo Platform
About us
Customers
Partners
Contact us
Newsroom
Enterprise Offers
Blog
About us
Resource center
Careers
Contact us
Try eXo
  1. Accueil
  2. Uncategorized
  3. Building a Marketing Dashboard to Display Metrics from Google Analytics and Sourceforge

Building a Marketing Dashboard to Display Metrics from Google Analytics and Sourceforge

The eXo marketing team wanted to be able to view website visit information with daily download statistics in a single view, without having to log into 2 separate sites and manually pull down reports. We solved this problem by building a gadget that can pull data from Google Analytics (visitor statistics) and from Source Forge (download statistics).

01-xSelection_017

Integrate your website with Google Analytics

We use Google Analytics (GA) service to track our website visit and page view. At first, you would need a Google account which enables you to access to all Google products and services (e.g Gmail, Play, Google+ …) then you can sign up to use Google Analytics feature. One GA account could have several web properties and a web property can be referred to as one website which can be tracked independently. Each web property will have at least one analytics profile that has access to all the analytics data and reports. The details of the relationship is highlighted in the below diagram

02-xGoogle_User_Profile_Account1

After register successfully for a GA account, you need to create your own web property and get the tracking code. Paste this tracking code into code of every single page that you want to track.

03-xSelection_018

There is an automatically created profile named All Web Site Data. This profile ID is unique and you will take this profile ID to pull out your analytics data.

04-xSelection_019

Getting Data from Google Analytics

We will access Google Analytics data through Google API. To do so, please follow these steps:

1. Register a project in the APIs Console (you can use the same Google account which you used for Google Analytics).

2. In the Google APIs Console, make sure you have Analytics API switch to ON.

05-xSelection_020

3. In Credentials pane, create a client ID with the Application Type set to Service Account.

06-xSelection_022

This would ask you to save a .p12 file which is a private key allows you to access your Google APIs without login. Save this file and name it as ga_privatekey.p12. You will take responsibility to safely keep and use this file.

4. Sign-in to Google Analytics and navigate to the Admin section.

5. Select the account for which you want the application to have access to.

6. Add the email address, from the Client ID created in the APIs Console from step #3, as a user of the selected Google Analytics account and grant at least read permission for this user.

07-xSelection_024

In this google-analytics-client-0.1.jarA we have provided a REST as a Google Analytics API client. This REST will use ga_privatekey.p12 file to get login to Google Analytics API. To deploy this REST, you just need to copy this google-analytics-client-0.1.jar file into the /lib folder of your Tomcat home folder and copy ga_privatekey.p12 file into Tomcat home folder then restart your Tomcat server. In our gadget, we make call to this REST. To use this gadget, you need to provide some preferences like the email address of client ID (GA ID) which generated in step #3 and the Analytics profile ID (Analytics View ID) you would like to access.

<userpref datatype="string" default_value="" name="Analytics_View_ID">
<userpref datatype="string" default_value="" name="GA_ID"></userpref></userpref>

The REST would help you to obtains the visit information of given analytics profile.

        function getVisitsData() {
                var analytics_view_id = prefs.getString("Analytics_View_ID");
                var GA_Account_ID = prefs.getString("GA_ID");
                var d  = new Date();
                var start_date = paramDate(new Date(d.getTime()-7*24*60*60*1000));
                var end_date = paramDate(d);
                var url = '/rest/ga/get-data/'+GA_Account_ID+'/'+analytics_view_id+'?start_date='+start_date+'&end_date='+end_date;
                return $.parseJSON(queryREST(url,null).responseText);
        }

Getting Data from Sourceforge

We use API provided by SourceForge to get the downloads statistics data. You need to provide your SF project name as a preference.

<userpref datatype="string" default_value="" name="SourceForge_proj_name"></userpref>

Then we can simply get and extract these data using YQL.

        function getDownloadsData() {
                var proj_name = prefs.getString("SourceForge_proj_name");
                var d  = new Date();
                var start_date = paramDate(new Date(d.getTime()-7*24*60*60*1000));
                var end_date = paramDate(d);
                var fakeTimestamp=d.getUTCHours() + d.getUTCMinutes();
                //provide url to your sourceforge.net project
                var url = "https://sourceforge.net/projects/"+ proj_name +"/files/stats/json?start_date="+start_date+"&end_date="+end_date+"&fake="+fakeTimestamp;
                var query = "select * from json where url=\"" + url + "\"";
                return $.parseJSON(queryREST("https://query.yahooapis.com/v1/public/yql",{ q: query, format: "json" }).responseText);
        }

Drawing the Dashboard Chart

We are going to use highcharts.js to draw our graph. It takes 3 data arrays: time frame data, visits stats data & downloads stats data. Now we are ready to create our beautiful chart which show the visits and downloads statistics of the last 7 days

        function drawChart(dataVisits, dataDownloads, dataCats){
        chart=new Highcharts.Chart({            
                        chart: {
                                                renderTo: 'container'
          },
          title: {
                text: 'Website Visits & Downloads'
          },            
          xAxis: [{
                categories: dataCats
          }],
          yAxis: [{ // Primary yAxis          
                labels: {
                        format: '{value}',
                        style: {
                                color: '#5373a9'
                                }
            },
            title: {
                text: 'Downloads',
                style: {
                        color: '#5373a9'
                                }
                },
            min : 0,
            allowDecimals: false
          }, { // Secondary yAxis
                labels: {
                        format: '{value}',
                        style: {
                                color: '#ffcb08'
                                }
                        },
                        opposite: true,
                        title: {
                                text: 'Website Visits',
                                style: {
                                color: '#ffcb08'                                
                                }
                        },
                        min : 0,
                        allowDecimals: false
                        }],
                        tooltip: {
                                shared: true
                                },
                                legend: {
                                        layout: 'vertical',
                                        align: 'center',
                                        x: 0,
                                        verticalAlign: 'top',
                                        y:20,
                                        floating: true,
                                        backgroundColor: '#FFFFFF'
                                        },
                                        series: [{
                                                name: 'Downloads',
                                                color: '#5373a9',
                                                type: 'column',
                                                data: dataDownloads
                                        }, {
                                                name: 'Website Visits',
                                                color: '#ffcb08',
                                                type: 'spline',
                                                yAxis: 1,
                                                data: dataVisits
                                        }]
                                });
                        }

Going Further

Extending the marketing dashboard will make it easier to identify patterns and determine the impact of various marketing activities on driving key metrics. You could also pull articles from your blog, in order to include other company events in the graph.

Useful Resources

  • MarketingMetricsGadget.xml
  • google-analytics-client-0.1.jar
  • Source code for google-analytics-client-0.1.jar

Questions? Remarks? Join the discussion on the eXo Community!


make-the-most-out-of-eXo-platform4

Make the most out of eXo Platform 4

Register to the next webinar and get a complete overview of what you can do with eXo Platform 4. Reserve your seat now!

Brahim Jaouane

I am a Digital Marketing specialist specialized in SEO at eXo Platform. Passionate about new technologies and Digital Marketing. With 10 years' experience, I support companies in their digital communication strategies and implement the tools necessary for their success. My approach combines the use of different traffic acquisition levers and an optimization of the user experience to convert visitors into customers. After various digital experiences in communication agencies as well as in B2B company, I have a wide range of skills and I am able to manage the digital marketing strategy of small and medium-sized companies.

Full-featured digital workplace with everything your employees need to work efficiently, smartly integrated for a compelling employee experience

  • Product
    • Software tour
    • Internationalisation
    • Mobile
    • No Code
    • Architecture
    • Integrations
    • Security
    • Open Source
  • Uses cases
    • Employee Portal
    • Knowledge management
    • Entreprise Social Network
    • Employee Engagement
    • Community Management
    • Extranet
  • Guides
    • What is a digital workplace?
    • Intranet guide
    • What is an extranet?
    • Employee engagement
    • Collaboration guide
    • Teamwork guide
    • Internal Communication guide
  • Enterprise
    • Product offer
    • Services Offer
    • Customers
    • About us
  • Resources
    • FAQs
    • Resource Center
    • Intranet Portal
    • What Is a Collaboration Software?
    • Talent Management
    • Employee Connection
    • Employee Intranet
    • Improve internal communication
    • eXo Tribe
  • Terms and Conditions
  • Legal
  • Privacy Policy
  • Accessibility
  • Contact us
  • Sitemap
  • Facebook
  • Twitter
  • LinkedIn
wpDiscuz