Abstract
Dataform Ga4 Sessions is an open-source Digital Marketing & SEO project. Dataform-ga4-sessions is a Dataform package to prepare session and event tables from Google Analytics 4 (GA4) BigQuery raw data. It is built using JavaScript. Key capabilities include: An easy and fast way to create a session and events table from GA4 raw data without writing SQL; Get session source/medium, campaign, and other traffic source dimensions; Get session default channel grouping by the rules close to GA4 definitions. The complete source code is publicly available on GitHub under the MIT License, making it a useful reference for students building a Digital Marketing & SEO mini project or final-year project.
1. Introduction
dataform-ga4-sessions is a Dataform package to prepare session and event tables from Google Analytics 4 (GA4) BigQuery raw data.
This repository is deprecated and no longer maintained. Please use GA4Dataform instead.
2. Objective
dataform-ga4-sessions is a Dataform package to prepare session and event tables from Google Analytics 4 (GA4) BigQuery raw data
This project demonstrates how JavaScript can be applied to a real-world Digital Marketing & SEO problem.
3. Key Features / Modules
- An easy and fast way to create a session and events table from GA4 raw data without writing SQL
- Get session source/medium, campaign, and other traffic source dimensions
- Get session default channel grouping by the rules close to GA4 definitions
- By default, you get two attribution models: last click and last non direct click
- Base session assertions: timeliness, completeness, validity
- Set a result session table schema: standard or extended
- Highly customizable: add your own columns, processing steps, source medium rules etc.
- Unit tests for the main cases
- Event class to create event tables from GA4 raw data
- Events factory to create recommended and auto events
4. Technology Stack
5. System Requirements
General requirements for this technology stack — check the README for exact versions.
- Node.js (LTS) and npm
- A modern web browser
- VS Code or any code editor
- Git (to clone the repository)
6. Installation & Setup
git clone https://github.com/ArtemKorneevGA/dataform-ga4-sessions.git
cd dataform-ga4-sessions- Initialize a new Dataform project and initialize development workspace following the instructions here.
- Add dataform-ga4-sessions to your project dependencies in package.json.
- Add the following code to your definitions/ga4.js file:
- sessions
- add_payment_info, add_shipping_info, add_to_cart, add_to_wishlist, begin_checkout, generate_lead, purchase, refund, remove_from_cart, view_cart, view_item, view_item_list
{
"name": "my-dataform-project",
"dependencies": {
"@dataform/core": "2.6.7",
"dataform-ga4-sessions": "https://github.com/ArtemKorneevGA/dataform-ga4-sessions/archive/refs/tags/v1.0.5.tar.gz"
}
}const ga4 = require("dataform-ga4-sessions");
// Define your config
const config = {
dataset: "analytics_XXXXXX",
incrementalTableName: "events_XXXXXX",
};
// Declare GA4 source tables
ga4.declareSources(config);
// Create sessions object
const sessions = new ga4.Session(config);
// Publish session table
sessions.publish();
// Publish session assertions
sessions.publishAssertions();
// Create event factory object
const ef = new ga4.EventFactory(config);
// Create all recommended form tracking events
let events = ef.createEcommerceEvents();
// Publish events
events.forEach((event) => event.publish());Full setup instructions are in the project README.
7. Future Enhancements
Suggested extensions you can add to make this your own project.
- Export reports to Google Sheets or PDF
- Schedule weekly automated reports
- Add competitor comparison
8. Viva / Review Questions
Common questions examiners ask for projects in this domain.
- Which marketing or SEO problem does this tool solve?
- Which data sources or APIs does it use (Search Console, Analytics, social platforms)?
- Which metrics or KPIs does it report and how are they calculated?
- How could the output help a business make decisions?
- How would you schedule it to run automatically?
9. Source Code & License
This project is developed by ArtemKorneevGA and published on GitHub under the MIT License. Please follow the license terms and credit the original author when you use or modify this code.
Want to build this as your internship project?
Work on a Digital Marketing & SEO project like this with mentor guidance, weekly reviews and an internship certificate from Training Trains, Erode — online or offline.
Apply for Digital Marketing & SEO Internship