JavaScript, webdev

YouTube Analytics Dashboard With Apps Script

player_apisThere are cases where you wish to collect statistics on your youtube videos or channel. There are few options to do it with YouTube API. As the YouTube’s API supports many languages you can choose the one that will work for your environment. In many of these options, you will need to develop a server side that will fetch the data and a front-end to present it and give the users option to query it. If you wish to dive deeper (e.g. specific metric on channel performance and videos statistics), you will need to work with YouTube Analytics API.

In this post, we will see a simple example to create a dashboard that will be updated on a daily basis. Since we wish to save ourselves from building (and maintaining!) a server side and a web app to access it, we will use the power of Google Apps Script (GAS) and Google sheets.

The Dashboard

Here you can find the “Dashboard example sheet”.
Feel free to copy it and work on your own version that is not in ‘read-only’ mode. Continue reading

Advertisement
Standard
Chrome, JavaScript, webdev

(Try To) Predict The World Cup With Monte Carlo Simulation

brazil 2014 world cupWho will win this world cup? Brazil without Neymar? Lionel Messi? Or are we going to see the Nederland making a big surprise?

If you like coding, statistics and problems that are not trivial… You found the right place. In this post, I will try to show an example to a way for solving this type of questions. For the readers that don’t remember what is Monte Carlo simulation (don’t be shy) – You might want to check a previous post that I wrote last summer and give you an intro to the world of Monte Carlo on Apps script and Google compute engine.

Monte Carlo experiments (simulations) are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. In most cases, we will run our simulations many times over in order to obtain the distribution of an unknown probabilistic entity.  This tool is often used in physical and mathematical problems and are most useful when it is difficult or impossible to obtain a closed-form expression, or infeasible to apply a deterministic algorithm.
In the real world, we see it being mainly used in three distinct problem classes:
* Optimization.
* Numerical integration.
* Generation of draws from a probability distribution.

 

OK, there is no time. The game starts in two days.

The Idea

Monte Carlo simulations tend to follow a particular pattern. Here is how we will use this tool: Continue reading

Standard
JavaScript, webdev

2014 World Cup Matches And Results

brazil 2014 world cupThe world cup is the biggest sporting event on the planet. During the last world cup in 2010, 3.2 billion people watched at least one of the games. As I know, many groups are going to ‘make it interesting’ by placing bets on the results, I thought it would be good to have all the data on a spreadsheet. Google sheets are ideal for that as they offer a great ability to share, comment and ‘play’ with the data. You can see the demo spreadsheet: http://goo.gl/ZjdfqE and fork the code from: https://github.com/greenido/WorldCup

For now, we are fetching the info from these end points: Continue reading

Standard
Chrome, JavaScript

Monitor Your Site With Apps Script

Network alertIn this short tutorial we will see how to built an application that can be used as a (simple) Nagios but, without the need to set up a server and maintain a lot of code. It’s not a replacement to a ‘full’ monitoring systems that give you rich set of abilities but more ‘an idea’ to show you the power of Google cloud with Apps script. The main three components of our system will be:

  1. Google Spreadsheet – We will use two sheets. One to allow us to set configuration data like: urls to monitor, email to get notifications etc’. The other will be our ‘log’. We will write to it all the alerts so we could analyze them later.
  2. Google Form – This will be a quick and easy way to acknowledge that we are aware for the situation and we wish to mute the emails.
  3. Apps Script – All the logic for the checks, alerts and everything in between will be done with a short script with one trigger.

For the first two components, we will use a regular google sheet that looks similar to this: Continue reading

Standard
cloud, HTML5, JavaScript, mobile, php

Google Cloud Platform Update

Google cloud platform updateYesterday we had a very cool event at Google’s offices. There were many mobile and web developers that came to hear what is new with Google cloud technologies (among other thing). I’ve used this set of slides because I knew they will be useful to many more developers that miss the event. That is the reason, I’ve used ‘a lot’ of words on each slide.

The event was recorded and I will update this post with the video soon. Have a great 2014! Continue reading

Standard
Chrome, HTML5, JavaScript

Mobile Web App – Real Life Example

App scriptThis week in Google Developers Live Israel, we showed a live example of a mobile web app that is built in two ways. One we used jQueryMobile as our UI framework and for cases where we need to support IE we used bootstrap. All the code can be found on github. The nice aspect in this real demo is that we used google sheets are our ‘server side’ and since its got a cool way to publish their content to the web as RSS, ATOM, XML, JSON feeds we could work with them from the web/mobile apps. The three main elements we used are: Continue reading

Standard
HTML5, JavaScript, webdev

Big Query Power With JavaScript

Big Query and App script logoThis week on Google developers live Israel we wanted to show the power of Big Query. What is Big Query? Well, in todays world when everyone like to use the term “big data” you need to have the capabilities to querying massive datasets. This can be time consuming and expensive without the right knowledge, hardware and infrastructure. Google BigQuery solves this problem by enabling super-fast, SQL-like queries against append-only tables, using the processing power of Google’s infrastructure. In order to get started quickly and ‘test the water’ there is a powerful online tool that let you query pre-existing datasets like: wikipedia, Github etc’. If you like to type in command line, there is also a command line tool. Before you start your first project you should signup for BigQuery (yes! it’s open now for all). You should log in to the Google APIs Console and make sure you set a new project and allow Big Query API on it. You should also, enable billing if you have not done so in the past. Lastly, head to bigquery.cloud.google.com and click on one of the public datasets that are on the left sidebar. Continue reading

Standard
Chrome, HTML5, JavaScript, webdev

HTML5 And Google App Script

App scriptIn our GDL-IL today, I’ve talked about a fun project I did in the past. It’s a single web page application that let you manage an event. We covered some of the basic components we used in order to built this site and then we jumped into the app script code and showed how to work with the online IDE that let you write, run and debug your server side code. The site gives you basic functions like: Continue reading

Standard