This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main: | |
params: [event] | |
steps: | |
- init: | |
assign: | |
- parent: projects/[your-project]/locations/europe-west4/repositories/[your-repo] | |
- extract_tableId_step1: '${json.decode(base64.decode(event.data.message.data))}' | |
- extract_tableId_step2: '${extract_tableId_step1.protoPayload.metadata.tableCreation.table.tableName}' | |
- extract_tableId_step3: '${text.split(extract_tableId_step2, "/")}' | |
- extract_tableId_step4: '${extract_tableId_step3[len(extract_tableId_step3) -1]}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config { | |
type: "declaration", | |
database: "your-database", | |
schema: "analytics_123456789", | |
name: dataform.projectConfig.vars.GA4_TABLE, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config { | |
type: "incremental", | |
description: "Counts the amount of specific events per session per day.", | |
schema: "monitoring", | |
tags: ["ga4"], | |
bigquery: { | |
partitionBy: "event_date", | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"defaultSchema": "dataform", | |
"assertionSchema": "dataform_assertions", | |
"warehouse": "bigquery", | |
"defaultDatabase": "your-database", | |
"defaultLocation": "EU", | |
"vars": { | |
"GA4_TABLE": "events_*" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main: | |
params: [event] | |
steps: | |
- init: | |
assign: | |
- parent: projects/[your-project]/locations/europe-west4/repositories/[your-repo] | |
- extract_tableId_step1: '${json.decode(base64.decode(event.data.message.data))}' | |
- extract_tableId_step2: '${extract_tableId_step1.protoPayload.metadata.tableCreation.table.tableName}' | |
- extract_tableId_step3: '${text.split(extract_tableId_step2, "/")}' | |
- extract_tableId_step4: '${extract_tableId_step3[len(extract_tableId_step3) -1]}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gpxpy | |
import matplotlib.pyplot as plt | |
import datetime | |
from geopy import distance | |
from math import sqrt, floor | |
import numpy as np | |
import pandas as pd | |
import haversine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Loads the content of a Google Drive Spreadsheet into BigQuery | |
* Based on: | |
* - https://www.lunametrics.com/blog/2017/07/26/connect-google-analytics-data-tools-via-bigquery/ | |
* - https://developers.google.com/apps-script/advanced/bigquery | |
* Edit by Wouter Nieuwerth, w.nieuwerth@adwise.nl | |
* https://www.adwise.nl | |
*/ | |
function loadSpreadsheet() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An example tag template that makes a request to OpenWeatherMap.org | |
// and sends data about the weather to both GA4 and Universal Analytics. | |
const getAllEventData = require('getAllEventData'); | |
const getEventData = require('getEventData'); | |
const JSON = require('JSON'); | |
const sendEventToGoogleAnalytics = require('sendEventToGoogleAnalytics'); | |
const sendHttpRequest = require('sendHttpRequest'); | |
const client_id = getEventData('client_id'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Send data to Universal Analytics | |
const getEventData = require('getEventData'); | |
const sendEventToGoogleAnalytics = require('sendEventToGoogleAnalytics'); | |
const client_id = getEventData('client_id'); | |
const events = { | |
'x-ga-measurement_id': 'UA-XXXXXX-1', // Replace with your own GA UA ID | |
'v': 1, | |
't': 'event', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Send data to GA4 | |
const getAllEventData = require('getAllEventData'); | |
const sendEventToGoogleAnalytics = require('sendEventToGoogleAnalytics'); | |
const events = getAllEventData(); | |
// Add extra fields to the events object: | |
events.firstname = 'Wouter'; | |
sendEventToGoogleAnalytics(events, (response) => { |
NewerOlder