Linus Larsson's blog

Using clipboard to import and export data in R

Published on 2019-02-07 in R

With this script you can create vectors or data frames in R simply by marking the data you want and copy it to the clipboard. Then one simple line in R will import the data from the clipboard and structure it correctly. This is super useful when working with Excel or when you’re browsing the...

Continue reading »

Scraping Trustpilot Reviews With R

Published on 2019-02-03 in R

[UPDATE 2022-11-25]: Trustpilot has changed their DOM, which means that this script will no longer work. You might be able to solve it by replacing some of the scraping attributes, but I have not had time to update the code myself. First of all, I have to give a huge load of credit to Fredrik...

Continue reading »

Detailed Attribution in Google Analytics 360

Published on 2019-01-31 in R

Are you ready to get you mind blown away? This R script is probably the best script in the world. Well maybe not, but it’s definitely up there in the top. What the script will produce is the output below. If you are currently using Google Analytics 360 and you have connected it to Google...

Continue reading »

Google Analytics Related Products with R

Published on 2019-01-22 in R

I finally managed to create something really beautiful! With the following script in R you will be able to find out what products your visitors are buying in the same transaction. I will explain how it works one piece at a time. It’s never a good idea to simply copy paste a script without understanding...

Continue reading »

Import Google Analytics data to BigQuery without 360

Published on 2019-01-16 in R

Wouldn’t it be great if you could store your Google Analytics data in BigQuery without having to pay for a Google Analytics 360 license? With this script in R you could do just that. Although, you will not get all the detailed data that you get with the 360 connection. If you decide to import...

Continue reading »

Tracking meta tags with Google Tag Manager

Published on 2019-01-15 in GTM

This is a very useful function that I have used quite a lot. Maybe you want to import the meta description for each page to Google Analytics or perhaps the developers have made some variables available in meta tags instead of using a data layer. Of course you could make the information available in the...

Continue reading »

Conversion rate per page in Google Analytics with R

Published on 2019-01-07 in Analytics

I often get questions about how to evaluate if a page has been useful in the customer journey on the website. You could check this by a lot of different KPIs but many of them aren’t very good. For example, I think page value is an irrelevant metric since Google analytics will split the transaction...

Continue reading »

Running initial code only once in R script

Published on 2018-12-10 in R

This script helped me a lot once I figured it out. When I work in R I usually split different functions in different script files and then import them to the “main” script, but if you do this you don’t want  to import all functions each time you run the script. So how can you...

Continue reading »

1 2 3
Cookie Settings

© Copyright - - 2018-2024