Skip to main content

How-to

Step-by-step guides, tutorials, and instructional content (117 posts)

BigQuery AI.GENERATE tutorial: turn SQL queries into AI-powered insights

BigQuery just got a major upgrade, you can now plug directly into Vertex AI using the new AI.GENERATE function. Translation: your analytics data and generative AI are now best friends, and they’re hanging out right inside SQL. That opens up a whole world of new analysis options for GA4 data, but it also raises some questions: * How do you actually set it up? * What’s it good for (and when should you avoid it)? * Why would you batch the query? Let’s walk through it step by step. Step 1: H

Katie Kaczmarek3 Sept 2025

How to start forecasting in BigQuery with zero training

If you’d told me five years ago that I’d be forecasting product demand using a model trained on 100 billion time points… without writing a single line of ML code… I probably would’ve asked how many coffees you’d had that day ☕️ But its a brand new world. And it’s possible. Let me explain What is TimesFM? TimesFM is a new foundation model from Google, built specifically for time-series forecasting. Think of it like GPT for time, instead of predicting the next word in a sentence, it predicts t

Katie Kaczmarek14 Jul 2025

Data pipeline optimisation with Google Cloud and Dataform

In our recent engagement with a client, we went on a journey to transform their data pipelines, tackling inefficiencies in performance and cost within their Google Cloud BigQuery environment. Our efforts culminated in a comprehensive optimisation strategy that used Dataform, improved SQL practices, and implemented tailored solutions for significant performance gains and cost savings. Here’s a deep dive into the highlights of our project. Identifying inefficiencies in BigQuery workflows We beg

Prasanna Venkatesan22 Apr 2025

Dataform for BigQuery: A basic end-to-end guide

Dataform is a powerful tool for managing your data workflows in a structured, version-controlled, and automated way. Whether you're a beginner or an experienced data engineer, Dataform simplifies SQL-based transformations while integrating seamlessly with Google BigQuery. Although this blog offers a basic introduction to Dataform's functionality, users can achieve significantly more with Dataform. From advanced scheduling, parameterised queries, and dependency management to complex data modelli

Prasanna Venkatesan18 Mar 2025

Behind the Cloud – Releases and scheduling in Dataform

In this episode of Behind the Cloud, Matthew dives into the details of releases and scheduling in Dataform. He breaks down how to manage different versions of your codebase in GitHub. From taking snapshots, to scheduling executions at various intervals daily, hourly, or monthly. By the end of the episode, you’ll have the know-how to confidently release and schedule your code, making it easier to build robust tables and models with Dataform. Watch below 👇 on Youtube, or catch more from the ser

Matthew Hooson7 Mar 2025

How to extract GA4's event sequencing in BigQuery using the new batch fields

Google Analytics 4 (GA4) exports event data to BigQuery, enabling detailed user behavior analysis. However, GA4 batches events before sending them, making GA4 event sequencing in BigQuery more complex. Fortunately, three fields—batch_event_index, batch_ordering_id, and batch_page_id—help provide precise sequencing information. For a full schema of the GA4 export, head over to google documentation. This article breaks down these fields in a clear, practical way and shows how to use them togethe

Katie Kaczmarek24 Feb 2025

Automating BigQuery workflows with conditional logic and data readiness checks

BigQuery offers powerful scripting capabilities that can simplify complex workflows. In this post, we’ll explore two essential techniques: using IF...THEN...END IF for procedural control and leveraging the metadata in project.dataset.__TABLES__ to ensure your Google Analytics 4 (GA4) data is ready before running queries. These strategies help you avoid unnecessary processing, reduce costs, and improve efficiency in your data pipelines. 1. Leveraging IF...THEN...END IF for procedural logic Whi

Katie Kaczmarek20 Feb 2025

A step-by-step guide to migrating scheduled queries to Dataform

Managing scheduled queries in BigQuery often feels limiting — there’s no version control, no easy collaboration, and scaling can be difficult. If you’ve ever wondered how to make SQL workflows smoother, Dataform is your answer. In this post, I’ll show you how I migrated a BigQuery scheduled query to Dataform and how it transformed the way I manage my data pipelines. After all, we all want to know who’s been touching our queries, don’t we? Getting started in Dataform First thing you need to

Katie Kaczmarek27 Nov 2024

How to set up a Dataform repository with GitHub & Google Cloud integration

Setting up a Dataform repository can be challenging without the right steps. Whether you’re new to Dataform or want to optimise your workflow, this guide will show you how to seamlessly connect it with GitHub and Google Cloud (GC). What is Dataform and why use it? Dataform is a powerful tool for managing version-controlled SQL workflows in a collaborative way. GC incorporates BigQuery and GitHub integration, providing an efficient way to organise and maintain complex data pipelines. Let’s bre

Katie Kaczmarek27 Nov 2024

What is offline event data import in GA4?

Offline event data import in Google Analytics 4 allows you to upload event data that was acquired outside of your website or app, such as in-store purchases, contact centre interactions, or CRM data. This can be critical for businesses seeking to bridge the gap between online and offline user actions, resulting in a more complete picture of customer behaviour. How to import offline event data into GA4 You can upload event data into GA4 through a process called Data Import. This can be done ma

Nasima Khatun22 Nov 2024

Behind the Cloud: The essentials of Google BigQuery

In this episode of Behind the Cloud, Matt discusses the essentials of Google Cloud’s BigQuery. Everything from project structure, data handling, to understanding the costs involved. Watch below 👇 or head over to our YouTube channel Transcript [00:00:00] Matt: Hello and welcome to Behind the Cloud. Today we’re going to be diving into the nuts and bolts of Google Cloud’s BigQuery and how it can help to revolutionise your marketing analytics. Whether you’re really familiar with the cloud or th

Matthew Hooson7 Feb 2024

GA4 app attribution case study: Pret + Adjust integration

Pret a Manger is a brick and mortar chain of coffee shops serving freshly made food and good organic coffee. They have 600+ stores distributed globally and their analytics team is responsible for over 30 million events every month collected across both web and app.  “Measurelab have been a key partner to us as we’ve undertaken a complete overhaul of our app and web analytics. Having access to the wide range of skillsets within the organisation has been invaluable as we’ve embarked on this journ

Mark Rochefort1 Nov 2023

Customising GA4's reports menu using the report library

By now you’ll all have GA4 up and running (I hope!) but now the realisation is kicking in that you have to actually start using the UI and I don’t know about you all but for me, it didn’t quite feel right. Let’s talk about the UI, where the hell did all my reports go?! I miss Universal Analytics UI! There I said it. GA4 is fantastic and I love some of the new features they have brought out like creating and modifying events from within the UI and the additional layer of user acquisition; howev

George Mendham29 Aug 2023

Getting started with Plotly Dash

This blog post is a brief introduction to Plotly Dash and a short tutorial to learn how to build a custom visualisation. For this tutorial, you will need some basic knowledge of Python, HTML and JavaScript. This article will focus on locally building and visualising your graph. What is Plotly Dash? Let’s start with the basics: what is Plotly Dash? Dash is a Python framework created by Plotly to render interactive dashboards which can also be hosted online, by using just Python. Dash has both

Natalia Rizzi22 Aug 2023

How to set up GA4’s custom insights and email alerts

What are custom insights? Sometimes the data available in Google Analytics 4 (GA4) can seem a bit overwhelming especially if you have a complex site with lots of users coming and going every day. It can often seem difficult to quickly identify the most important trends or anomalies. Thankfully GA4’s Analytics Intelligence is here to help bring some much needed clarity. This is a group of features that uses modelling to help you understand your data. Insights is one such feature and it comes in

Timothy Gorringe17 Apr 2023

How to create events in GA4 using the UI

Google Analytics 4 (GA4) now gives users the ability to create new events or modify existing events through the use of the GA4 user interface. This is a fantastic add-on available to all and will be welcomed by those who are not familiar with their existing tag management system or do not have the relevant tech resources available to make some changes in a timely manner. Why would you create an event? First of all, creating a new event keeps you safe from interacting with existing events that

Olade Honvo11 Apr 2023

How to build an interactive GA4 BigQuery data schema

What and why? One of the great features of Google Analytics 4 (GA4) is the ability to pass data into BigQuery (BQ). There are many benefits to this which have already been covered in some of our previous blogs (i.e. 10 reasons to export your GA4 data to BigQuery). Passing data to BigQuery is no longer just available to enterprise GA360 customers, but to anyone using GA4 for free. What I wanted to create was a simple interactive way to explore how GA4 data is saved in BigQuery. I found the GA36

Scott Hellmund23 Mar 2022

Google Analytics data import: automate data import with Python & Cloud functions

Why automate data import into Google Analytics A few months back I was granted access to a Google Cloud Source Repository (private Git repositories hosted on Google Cloud part of Google’s Cloud developer tools) that contained Python code and configuration details for automating the extraction of data from a BigQuery table and uploading to Google Analytics as a custom dimension via the Management API on a desired schedule. Choosing the right approach for blog word counts Being primarily a Jav

Victor Sarker16 Nov 2020

Turning classic GA calls into dataLayer pushes with GTM

This is part 3 of a semi-regular series, dedicated to reusable GTM solutions for scenarios or issues we’ve encountered more than once. Last time we looked at how to track clicks on iframes using GTM, and this time we’re looking at how to turn on-page classic Google Analytics calls to data layer pushes. The problem with hard-coded GA calls Say you still have hard-coded calls to classic GA on the page, but the library code itself was being delivered via GTM. It's now been removed, but there are

Adam Englebright9 Jan 2020

How to Conduct an Exceptional Training Session

So… you’ve been asked to conduct a training session and you don’t know where to start. Or, you’re looking for a way to take your current training process to the next level. Whatever your level of experience, the following tips will help you make your next training session exceptional. 1. Know the subject The first step in giving an exceptional training session is being deeply familiar with the subject matter. In the words of Albert Einstein: You may think you know a subject through and throu

Dave Beatty6 Dec 2019

GTM iframe tracking – Solutions Corner #2

This is part 2 of a semi-regular series, dedicated to reusable GTM solutions for scenarios or issues we've encountered more than once. Last time we looked at how to fire Google Analytics event to keep track of your Google Optimize experiments in GA, and this time we're looking at tracking clicks on iframes. We have encountered, several times, the situation of a client wanting to track clicks on an iframe. While we can't do much about interactions with stuff within the iframe without having GTM a

Adam Englebright2 Apr 2019

Google Analytics Enhanced Ecommerce tracking with Adobe DTM

Here at Measurelab, we work predominantly with the Google stack but that doesn't stop us using other tools. As there's not much documentation available in the public forum on how to implement Enhanced Ecommerce in Google Analytics using Adobe Dynamic Tag Manager (DTM) formerly know as Satellite, I think this blog post would be useful. As good introduction to the tools itself, below there’s a useful overview of Adobe’s Dynamic Tag Management architecture, which is from their learning resource pa

Alex Cirstea21 Jan 2019

Adding Firebase Analytics to your React Native app

<span style="font-weight: 400;">This article describes how to integrate Google Analytics for Firebase (formerly Firebase Analytics) to a React Native app. </span><span style="font-weight: 400;">In order to do this, you need to use a JavaScript bridge called </span><a href="https://github.com/invertase/react-native-firebase"><span style="font-weight: 400;">RNFirebase</span></a><span style="font-weight: 400;">. &nbsp;</span> This is lightweight layer sitting on top of native Firebase librarie

Alex Cirstea23 May 2018

Google Data Studio tips: tricks and best practices

Getting started with Google Data Studio Since its release back in May 2016, Data Studio (a free version of Data Studio 360) has made quite a lot of progress on improving its functionality. Of course, it is still in beta, so you might come across some system bugs and limitations, but the Google team is working hard to add new features and fix any issues the user may face, with at least two new releases per month (so far). I won't go into details as what you can do with the tool, as you can chec

Magdalena Pajak7 Dec 2016

How to integrate Optimizely with GTM & Universal Analytics

If you want to integrate your Optimizely experiment and variation data with Google’s Universal Analytics via Google Tag Manager, you will soon see that the official documentation assumes a custom‑coded implementation. It then instructs you to edit your GA pageview tag directly. If you are using Google Tag Manager, then you obviously will not want to follow this guidance as you probably have the Google Analytics pageview tag in a tag template. It is always advisable to keep custom JavaScript an

Steven Elliott16 Sept 2016

Understanding GA non-interactive events: month 1 insights

Starting a new adventure in analytics When I first decided to quit my ohh-so-lucrative job in the investment banking, most of my friends and family thought I was going bonkers! Neither were they impressed with my idea to start a new career in Web Analytics, working for some small start-up based in Lewes (wait why exactly do you want to work in Loos?!?). I must say that I had my doubts as well - will I be able to adapt to a totally new working environment? Will I ever learn what all the cookies,

Magdalena Pajak15 Sept 2016

Core Reporting API v4

<p class="p1">“<a href="https://developers.google.com/analytics/devguides/reporting/core/v4/changelog#header">Core Reporting API update</a>” doesn’t sound like the most exciting thing in the world, but trust me: it is. Well, maybe not <i>the</i> most exciting thing, but certainly getting on that way. So what’s new?</p> * Metric Expressions Are you sick of having to do post-processing on metrics in a separate sheet before you pipe them to your presentation layer? Well, guess what – you can

Adam Englebright14 Apr 2016

R for analytics beginners: part 4 – building graphs and analysing data

Earlier in this series we reviewed several R libraries for Google Analytics. Then we started using RGA. Next we pulled data from Google Analytics using RGA. What now? I’m reaching for my university notes, because we’re getting into proper R territory. Diving into graphs with R Let’s start with graphs! Who doesn’t love a good graph? It just so happens there’s a lovely R library called ggplot2 that does really excellent graphs of all shapes and sizes1. We’re probably best looking at a few speci

Adam Englebright19 Feb 2015

R For Analytics: A Beginner’s Guide, Part 3

<strong>IMPORTANT: THE PACKAGE HAS BEEN UPDATED BUT ADAM HASN'T HAD TIME TO UPDATE THIS YET! PROCEED AT YOUR PERIL!</strong> Last time, we had a look at how we could use RGA to pull in account details and suchlike. It’s not essential, but I’d suggest you go back and read through it, as it might make some of what we do next a little easier – and, of course, if you haven’t done so already, read the first piece too and follow the instructions enumerated therein to allow you to do, well, any of

Adam Englebright4 Feb 2015

R for analytics beginners: part 2 – authorizing GA access

In Part 1 of this series, I discussed R briefly and explained why it might be useful for people doing analytics work. I also introduced the libraries that allow you to interface R with Google Analytics. At this point, you should have R and RStudio installed on your computer, along with the RGA package. If you have not done this yet, please return to Part 1 and complete these steps first. Next, we need to authorise the package to access our GA data. You have to go to the Google Developers Consol

Adam Englebright29 Jan 2015

R for analytics beginners: part 1 – getting started

Two years ago, or thereabouts: I was introduced in my statistics lectures to a programming language and software environment called R. I took to it immediately, preferring it by far to the simpler software we’d used before, and also to the proprietary software (SAS, SPSS) we used in addition. Flash forward to: A couple of months ago, sitting in the audience for the talks at MeasureFest, and then we had what was, I think, by broad agreement, the best talk by Ela Osterberger, about using R with

Adam Englebright22 Jan 2015

Google Analytics health check: Part 2: third week guide

Continuing the GA health check Last week, I covered the first few steps of our Google Analytics Health Check, as one of the first, and most important steps when putting together a measurement plan. To recap a bit, the main aim of a Health Check is to ensure that we are collecting the right information, filtering out any undesired data, to allow us to create actionable reports for the stakeholders that, at the same time, help them to make informed business decisions. Checking goals and funnels

Juan Barros24 Nov 2014

Google Analytics health check – Part 1: second week guide

Diving into GA health checks Right, now that some of the basic concepts and industry jargon are starting to sound a bit more familiar, things are starting to get interesting – not that last week was boring but this week I’ve been having a go at one of the most important parts of a piece of “initial discovery” for a client: A Google Analytics Health Check. Our approach to health checks In this document, which the team creates for every single one of our clients, we run a detailed audit of the

Juan Barros17 Nov 2014

Floods, Scroll Depth, Bonfire and lots of coffee: My first week at Measurelab

<p class="p1"><span class="s1">It’s been, without a doubt, an unusual first week. Upon arrival to the mind-blowing <a href="https://www.measurelab.co.ukcontact/"><span class="s2">Old Candlemakers</span></a> building in central Lewes, I walked into the office to see the team running up and down trying to clean up the mess: one of the roof windows was left open during the weekend and we ended up with a meeting room that looked more like a fish pond than a place to catch-up or meet clients. Fort

Juan Barros10 Nov 2014

How to use the Google Analytics Embed API: guide & examples

When I started at Measurelab, way back in July, one of the items on my List Of Things To Do was to look into new and exciting ways of visualising data for clients. A few weeks ago I spent some time experimenting with dc.js but then, Mark and Dara went to MeasureCamp in London (I was going to go but I had other commitments) and came back bearing glad tidings of great joy for all analytics consultants, because unto Google, in the town of Mountain View, was born an API, and the angel Justin C

Adam Englebright1 Oct 2014

How to set up Google Analytics Enhanced Ecommerce (5 easy steps)

If you are anything like me, you will have seen the fandangled new “enhanced” e-commerce reports that are starting to become available in Google Analytics accounts (N.B. - Universal web properties only) and thought “yes, I’ll have some of that”. The reports allow for much deeper analysis of shopping behaviour - to understand things like influence of product impressions on conversion - as well as providing much anticipated refund and voucher/ affiliate code support. In the spirit of catchy blog

Mark Rochefort30 Jun 2014

Creating an effective Measurement Plan

When helping clients with their analytics implementations, we often run Measurement Planning workshops - bringing together stakeholders to better understand their measurement requirements. This video (part of the excellent <a href="https://analyticsacademy.withgoogle.com/">Analytics Academy</a> series) demonstrates a typical measurement planning and implementation process - closely aligned to the <a href="http://measurelab2.wpengine.com/blog/analytics-planning-is-at-the-heart-of-a-truly-measu

Mark Rochefort17 Jan 2014

GA Summit 2013: Key Google Analytics updates & insights

The theme of this years summit is a focus on helping customers in three areas: Access, Empower, Act. The slide above was shown by the GA team to summarise the 3 part theme. Babak Pahlavan (Director of Product Management, Google Analytics) let the crowd know that GA have made 70+ releases in 2013 so far, which makes sense on reflection given how busy the year has been. This has included major updates such as the global roll out of Universal Analytics, the introduction of the Attribution Modellin

Dara Fitzgerald2 Oct 2013