On a normal working day, we were a team of 4-5 people sitting together and had built a website earlier. We were not at all active in checking whether the website is used by ANYONE at all. So we started using Google Analytics for the same. Days passed by, and we were just too lazy to open up the google analytics dashboard everyday and check. Luckily, we had Alexa with us and we wanted something easier for us. Why not just ask Alexa about it?
What it does
It links with your Google analytics account and lets you configure to any of the multiple profiles/views present in your account completely through voice. You can ask the skill for the number of page views on any given day or a day range. For example :
- How many page views did I get today ?
- How many page views did I get between 5th April and 10th April ?
- How many page views did I get since last Saturday ?
How I built it
On the backend, I chose Python as the preferred coding language, and luckily, Amazon already has an Alexa skills kit example for Python. I then connected my code to the Google Analytics API for querying. The skill also uses a bit of Amazon's DynamoDB to store the user's view/profile ID, so that it runs smoothly without the user asking to configure every time.
Challenges I ran into
- Greatest Challenge : I had to learn about how to use ASK, how to use lambda and dynamodb, how to connect it to the Alexa device, etc.
- Alexa's DATE type slot always takes the future dates, for example if I say 5th April, it considers it as 5th April,2018 as the date has already passed by. I noticed this a bit later, and then manipulated it at back end.
- Experimenting with Google Analytics API.
Accomplishments that I'm proud of
I have successfully created an Alexa skill that makes it easier for me and my team (and hopefully many others) to perform a daily task and gain useful information from it.
What I learned
- How to code with the Alexa-skills-kit and how to publish a full fetched skill.
- Very much aware about Google Analytics API along with some other APIs as well.
- How to use Amazon-lambda, Amazon-DynamoDB, Amazon-CloudWatch.
What's next for Unofficial Google Analytics
The skill will come out with more metrics and more query parameters. Page views was one of the metrics.
Example of giving more power to query :
- How many page views did I get today from California?
- How many page views did I get this week from a Chrome browser?
Example of bringing in more metrics :
- How many active sessions were there this year?
- How many people have used my website in the French language?