Storing Unique Events from Google Analytics in Our Database

in STEMGeeks2 months ago

So we had a requirement in our company to know which projects are popular. Our company has done close to 60000 projects and they are into the business for 50 years. Now we had several key points to know about it like if the project is big, amount spent, the big client, number of photos about the project etc. But one other factor which was missing is how popular that project is with in the company.

image.png
PC: Pixabay.com

We have our own Search website where you can search the project based on anything and we have used SOLR for that. Now lets say SOLR gives certain value based on the search criteria and then we show that to the users based on the descending value of the SOLR value. We thought of adding one more parameter to it and that is how many clicks that project is getting and if it has more clicks boost the project a little than the rest.

So to do that we have added an event in google analytics code, where the event will be stored in google analytics whenever the user clicks on the project. And every week we will be running our pipeline to get the new events for that particular tag and store that in DB.

Now you might argue that what if User accidently clicks that several times. First of all no one knows about this except PM and the developers that there is boost on clicking the project and next the boost is too minimal for something like 100 clicks, you might need some 1000s of clicks to actually get project on top.

Why this is done because we were feeling that our search engine lacking something, and this is one of the parameter we thought of improving. Just like Google Search, if more and more people are clicking on a link that link will be higher than the rest and thus we have also done the same thing in our case.

When we run our indexing on SOLR we take an total count of click of all the project and thus based on that gets the SOLR indexing value.

The pipeline which we run is SnapLogic Pipeline and it has Google Analytics SNAP to correctly talk to it. We have used SnapLogic because our other 100s of pipelines work on it and its less time consuming too rather than writing it as a program.

image.png
PC: SnapLogic.com