Generator for Google Tag Manager

In the past two years, tag management evolved and became the leading technology used to manage tracking (and more) on the web. Meanwhile Google Tag Manager has established itself as a key player in the field of tag management.

While tag management empowers online marketers to do “powerful things”, it also adds a layer of complexity to their practice of web analytics.

For the marketers who have never setup tag management, the new concepts are repelling.
For the ones who have done it before, there is still no guarantee of quality.
For the ones who have done it more than a couple of times, most of the “clicking-through” of a container can feel repetitive.

Many reasons to come up with a boilerpate container for Google Tag Manager. We first used it internally for client work, and soon decided to share with the community in the form of a container generator.

Continue reading about Generator for Google Tag Manager

Tags: ,

Let’s debug in Drupal 8 !

It has been nearly 7 months since Drupal 8 first release and as a developer, I am still in the learning process. It can be hard sometimes to know what is going wrong with your code and how to solve it. I will tell you about few things to know on how to develop and debug Drupal 8 projects and continue learning, learning and learning !

Disabling cache

First of all, to avoid having a crazy terminal with thousands of drupal cr hits, you can disable Drupal caching during development. You need to copy and rename sites/example.settings.local.php file to sites/default/settings.local.php. Then uncomment/update some values:

  • uncomment this line to enable the “null cache service”:
  • uncomment these lines to disable CSS/JS aggregation:
  • uncomment these lines to disable the render cache and the dynamic page cache:
  • you can allow test modules and themes to be installed if needed with:

To include this file as part of Drupal’s settings file, open sites/default/settings.php file and uncomment these lines:

Then, to disable Twig caching, open sites/development.services.yml file and add the following settings:

Finally, rebuild the Drupal cache and it is done !

Continue reading about Let’s debug in Drupal 8 !

Tags: , ,

A recommender system for Slack with Pandas & Flask

Recommender systems have been a pet peeve of me for a long time, and recently I thought why not use these things to make my life easier at liip. We have a great community within the company, where most of our communication takes place on Slack. To the people born before 1990: Slack is something like irc channels only that you use it for your company and try to replace Email communication with it. (It is a quite debated topic if it is a good idea to replace Email with Slack)

So at liip we have a slack channel for everything, for #machine-learning (for topics related to machine learning), for #zh-staff (where Zürich staff announcments are made), for #lambda (my team slack channel) and so on. Everybody can create a Slack channel, invite people, and discuss interactively there. What I always found a little bit hard was «How do I know which channels to join?», since we have over 700 of those nowadays.

Bildschirmfoto 2016-06-16 um 11.34.12

Wouldn’t it be cool if I had a tool that tells me, well if you like machine-learning why don’t you join our #bi (Business Intelligence) channel? Since Slack does not have this built in, I thought lets build it and show you guys how to integrate the Slack-API, Pandas (a multipurpose data scientist tool), Flask (a tiny python web server) and Heroku (a place to host your apps).

Continue reading about A recommender system for Slack with Pandas & Flask

Tags: , , , , ,

Testing in the Cloud – Using Bamboo with Amazon AWS

Bamboo is the continous integration service by Atlassian, the company owning the code management service Bitbucket (as well as the Jira issue tracker and Confluence wiki). Bamboo can run test suites and build any kind of artefact like generated documentation or installable packages. It integrates with Amazon Web Services, allowing to spin up EC2 instances as needed. So far, I mostly worked with travis-ci, because of open source projects I maintain on github.com. What Bamboo does really better than travis-ci – besides supporting other code repository SaaS than github.com – is the dynamic allocation of your own EC2 instances. Bamboo is just the manager, and can be configured to spin up EC2 instances when the number of tests to run increases. This keeps the costs at Amazon to a minimum while offering large capabilities to run tests when needed.

Besides licensing a Bamboo CI server to run yourself, you can also use it as a cloud service. I recently helped set up tests with this. Unfortunately, the documentation is really worse than expected, and the integration hampered by really silly mistakes that we had to dig up in discussion boards and on stackoverflow. This blog post contains a few notes if you want to do the same that hopefully will help others facing the same challenges. A word of caution: we did most of this in March and April 2016 – things might get fixed or change over time…

Continue reading about Testing in the Cloud – Using Bamboo with Amazon AWS

Tags: , , ,

Order fulfillment with Swiss Post and YellowCube

Setting the stage

We live in a time where more and more goods are purchased online. May it be your airline ticket or the diapers for your newborn, many things are often cheaper and more conveniently purchased online. As comfortable it is for the customer buying things this way, as challenging it can be for the seller. They need to have an online presence that is easy to use and need to have all goods in stock to sell and send them quickly.

This means that selling physical products requires sufficient storage space on-site, people that handle picking, packing and shipping and someone that handles returned goods. All this factors can sum up to a costly venture, especially when you don’t have any infrastructure from other sales channels already.

Architekture PostLogistics YellowCube Connector

The PHP-YellowCube interface is part of all YellowCube extensions for PHP based web stores

What is order fulfillment?

This is where YellowCube comes in handy. YellowCube is a fulfillment service offered and run by Swiss Post. But what is a fulfillment service anyway? In the case of YellowCube it means everything to do with the storing and shipping of the products you sell on your store. This means receiving and storing of the products, handling of the inventory, picking, packing, shipping and handling of returns.

How to implement it into your web shop?

So far so good, but how does this translate into real life? Liip has, in close collaboration with Swiss Post, developed a PHP-YellowCube-SDK and also the integration for Magento and Drupal web shops. The PHP-YellowCube interface provides an object-oriented wrapper to the SOAP based interface provided by Swiss Post. The code is readily available on Github. Please feel free to contribute to the PHP-YellowCube-SDK, as well as the Magento extension or the Drupal extension.

Please explain…

Now that we know about the SDK, we need to know how the basic process works. I want to show you what needs to happen in order to implement YellowCube successfully into a web shop. The process is agnostic to a certain integration, so I won’t go into details how it is integrated in a specific shop extension. I will explain the basic process, which applies to all web shop integrations in the same manner (more or less).

Continue reading about Order fulfillment with Swiss Post and YellowCube

Tags: , , , ,

What’s your twitter mood?

The idea

  • Analyze tweets of a user for being positive, negative or neutral using machine learning techniques
  • Show how the mood of your tweets change over time

Why?

  • Fun way to experiment with Sentiment Analysis
  • Experiment with language detection

How

Gathering data

We analyzed tweets from Switzerland, England, and Brazil. We put extra care to make sure our model can do well against Swiss-German text.

Make awesome model in node

We created custom fast Natural Language Processor in node.js. Why node? It has very good run-time when dealing with lots and lots of strings. We used unsupervised machine learning techniques to teach our model the Swiss German and English writing model. Once we had a working model, we added couple other models using Bayesian inference to create an ensemble https://en.wikipedia.org/wiki/Ensemble_learning

Make nice front-end

portugese sentiment analysys

Once we got our server working we thought about adding some better UI. We asked our User Experience specialist Laura to suggest improvements. See for yourself:

mood-detector-graph1

Problems and learnings

Language detection is needed to use the right sentiment model

Design model for Swiss-German is especially hard: the language incorporates German, with a lot of French and Italian words. Also spelling of words changes from canton to canton. If we add that most people when writing tweets are forced to use abbreviation, we get the whole picture of the challenge.

An accurate model needs a lot of data

In order to get a good result we needed to incorporate data from various people and different nationalities. The good thing is that the more you use our model the more accurate it gets.

Training data is available

One of the problems is that for humans is hard to understand the irony or sarcasm. Especially in short tweets. So it’s also hard for a machine.

If you want to play with our results in this machine learning experiment:

http://liip.to/twittersentiment

 

I would like to thanks Andrey Poplavskiy for his “css love”, and Adrian Philipp for his huge contribution and encouragement towards this project.

Celebrating 3 years working at Liip

Lets recap.

There was a tiny Rita known as “esponjinha” (little sponge) due to her delight in spending time with friends drinking a good glass(es) of wine, beer, rum, tequila, whatever. The matter was enjoying the moment, but as a sponge, that moment could last long and long because even tiny, I always managed to “absorb” a lot! … What people didn’t know, is that my absorbent feature is actually a secret pleasure – not on drinking liquids (Alain Frapolli knows it well since he “forces” me to drink water every day) but – on taking the time to observe, to talk, to read people and empathize. Not (only) as a social demand, but because I love capturing details from my surroundings. Not just sensing people, also animals, objects, spaces and ubiquitous things.

Continue reading about Celebrating 3 years working at Liip

Tags: , ,

Holacracy Habits: Victim Mentality

The main obstacle in implementing Holacracy are habits that need to change. Holacracy pushes us to change our reflexes and habits that used to serve us so well and that’s why it’s so difficult. Identifying the habits is the first step in a successful implementation. One of those habits: playing the victim.

The comfort of playing the victim

In our everyday work life we often run into situation Tensionthat we feel we are unable to influence. The perceived gap between “what is”, the current reality, and “what could be”, the desired state, may seem too big and too deep to overcome. In situations like this we tend to act like we are oppressed by other persons, a process, a role, a persecutor – we start feeling like a victim.

A victim tends to look for someone to blame, feels helpless, powerless and unable to make decisions. Victims put their focus on what they don’t want instead of what they want. And sometimes we get comfortable in this position since playing the victim gives us reasons not to take action in order to close this perceived gap. In order to solve this tension.

Become a creator

In general there are two ways to solve tensions.

One way, and that’s what victims usually do, is to bring your desired state, your “what could be”, one step closer to the current reality. But even if this helped to release your tension, it doesn’t change your position.

The other way  is to bring your current reality, your “what is”, one step closer to your desired state, one step closer to your vision. This, however, requires that you take action and realise that you cannot expect or wait for things to change around you but that you can only change yourself. It  will inevitably change the way you see yourself and the way you see the situations you are in.

Acting on one’s own authority gives you the possibility to switch your focus from problems to results. Mental switches will follow. You’ll start shifting your motivation from wanting problems to go away to focussing on what you can do next to reach your desired state. Ultimately, you will stop being a victim and start becoming a creator.

The pathways in Holacracy

Holacracy will support you in becoming an effective creator by opening up multiple pathways and giving clarity for your next step forward towards your vision.

It empowers you to take any action you deem reasonable to solve your tension, unless it’s explicitly forbidden by clearly documented domains or policies. Explicit roles make it easy for you to know where you can get input from and what you can expect from them during your daily work. Tactical meetings give you the possibility to share or request informations and request next actions or project to be processed by other roles. And if it’s unclear which role can be expected to do what the governance process gives you the possibility to clarify those expectations.

Make a start out of the victim mentality and become a creator by asking yourself: what would I do if I knew I couldn’t fail? What would I do next in order to reach my goal if absolutely anything was possible? The pathways at your disposal will help you figure out what step to take next in order to get there.

Tags:

Drupal: Dynamic IMCE Profiles

Today I will describe a way to handle multiple teams with their own private file folders using the IMCE module.

Let’s pretend that we have to develop a website called awesome-website.com which consists of three (or more) different teams. The team structure could look as followed:

Website Groups

Every team should only be allowed to edit their own pages but no page from any other team. Therefore it would also make sense to separate the team’s file folders so that the files can be stored separately to secure its privacy.
Of course, we could simply add three IMCE profiles and define their folder access rights individually there. But what about when working with 10 teams? Or 50? Or even more? Then we definitely would prefer a more flexible solution.
Thankfully, IMCE ships with the ability to define user folders by PHP execution, how awesome! But in order to achieve this, we’ll have to set up teams as taxonomy terms first and reference them from our user entities.

Setting up the “Teams” taxonomy vocabulary

First things first: Let’s create a new taxonomy vocabulary called “Teams”. For every team that we will have on our website, we have to create a new taxonomy term in this vocabulary.
Before adding any teams as taxonomy terms though, we’ll have to add a new field called “FTP Folder” to the taxonomy vocabulary.
This field will specify the name of every team’s root folder. So, naturally it shouldn’t contain any spaces or other wicked special characters and it should be URL readable.
In order not to face any unusual results later, it is recommended to configure this field as required.

Afterwards, we can add our three terms, “Team Alpha”, “Team Beta” and “Team Gamma”.
As value for their FTP Folders, we use “team-alpha”, “team-beta” and so on.

That’s it for the taxonomy part! Now let’s link this information to the team’s users.

Adding a taxonomy term reference field to the user entity

In my case, I didn’t have multiple roles for the teams. I only had one, called “Team member”. Because every team has exactly the same rights as the others, maintaining only one role suited me best.
For really special cases, I could always just create a new role with the special permissions.

So, how do we link users to their teams the easiest? Exactly, by just adding a taxonomy term reference field to the user entity!
Let’s call this field “Team” and reference our previously created taxonomy vocabulary “Teams” with it.

Now, when adding a new user, we can select it’s team belonging and IMCE will be able to grab the needed information from there.
Yes, IMCE will be able to do that but it’s not doing it yet.
Getting the teams ftp folder for the current user is still something we have to code, so let’s proceed to the next step.

Writing a custom function to provide the accessible directories for an user

Now we need to provide IMCE the information that we’ve set up before.
We’ve created users belonging to teams, which hold the FTP root folder name for the teams.
What’s left to do, is to write a function (ideally in a custom module, in my example the module is called “awesome_teams”), that combines all information and returns it to IMCE.
Following function would do that for us:

The function expects an user object as argument and will return an array of strings containing all the folder names an user is allowed to access.
Our folder structure would look like this:

  • sites/default/files/cms
  • sites/default/files/cms/teams
  • sites/default/files/cms/teams/all
  • sites/default/files/cms/teams/team-alpha
  • sites/default/files/cms/teams/team-beta
  • sites/default/files/cms/teams/team-gamma

Note: The folder “cms/teams/all” is a special folder and every user is allowed to access it.
It will be used to save files which are used globally over multiple or even all teams.

What our code does, is actually looping over all assigned teams for the given user (yes, an user can be in multiple teams!), and adding the teams ftp folder names to the array of accessible folders.

There is no “hook_imce” hook, the “_imce” in the function name does nothing till now. You can also name your function differently. The link from IMCE to our function is something we have to set up in an IMCE profile.
Let’s proceed to the last step then, shall we?

Creating the IMCE profile “Team member”

Now, as the last step, let’s create an IMCE profile called “Team member”. You’re free to define any settings as you like, there’s only one thing that will be special about this profile: The accessible directories path.

Instead of writing something constant as “cms/teams/team-alpha”, we’ll write “php: return awesome_teams_imce($user);” here.
So, the setting should look like this:

imce-profile-settings

Now save the profile and you are done!

As soon as one team member now accesses the IMCE page (either via /imce or by the configured file/image fields), he will only see his team’s directories and the special directory “all” which is meant for exchange.

This wasn’t that difficult, was it?

I hope I was able to give you an insight on how to solve more complicated file permission issues with IMCE.
Don’t forget to give feedback, ask questions and follow our blog if you want to read more about our Drupal experiences at Liip!

Tags: , ,

Holacracy Habits: Make Autocratic Decisions

The main obstacle in implementing Holacracy are habits. Holacracy pushes us to change our reflexes and habits that used to serve us so well and that’s why it’s so difficult. Identifying the habits that need to change is the first step in a successful implementation. One of those habits: making decisions.

Traditional decision making

We are used to try to integrate different perspectives of different people while working together. While this sometimes leads to a more accurate and complete overview of the situation and allows for more informed decisions, it is often focussed on personal statements. Am I ok with it? Do I have anything against it?

The lack of clarity in terms of who is responsible for what, manifests in symptoms like tedious Slack discussions or meetings with the goal to integrate every perspective of every group member.

Yet, at the same time, there is always the risk of ignoring or dismissing valuable and critical perspectives, just because they are not shared by the majority or by a leading personality.

The shift in Holacracy

In Holacracy we want to change that by shifting the way decisions are made: by distributing the decision making power to roles instead of people. Every role in a holarchy has the full authority to make decisions on how to act upon its purpose and get work done. And while it no longer gives equal power to every person, it makes every person powerful in their roles.

Having the power to make autocratic decisions in your roles doesn’t mean you should never gather input. If you don’t feel able to make a meaningful decision with the knowledge and data you have at hand in that specific moment, you want to get all the information and advice you need. Having explicit roles in Holacracy makes it even easier for you to identify where you might get that information from and where to ask for advice.

The challenge lies in distinguishing between gathering input and holding back decisions. Keep asking yourself, are you still gathering information to help you make a decision, or are you hoping that others will approve your decision? And do you need others to approve your decision to move further?

It might actually be reasonable to have some other role approve your decisions on specific topics. You just need to know when you need to get approval and when you don’t. One way to achieve that is by making those mandatory advice processes explicit and Holacracy provides the tools to achieve that through roles and accountabilities, domains and policies.

Be aware of your roles

The goal is to raise awareness so that you can distinguish for yourself, if you are able to make an autocratic decision, if you need more information or advice in order to make a decision, if you have to follow a mandatory advice process or if you are just holding back.

So in order to boost your Holacracy implementation, be aware of the authorities of your roles, get advice from others but avoid asking for permission unless required, and make autocratic decisions.

Remember the golden rule of Holacracy:

Everything is allowed that is not explicitly forbidden.

Tags: