This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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) => { |
This file contains hidden or 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(); | |
sendEventToGoogleAnalytics(events, (response) => { | |
data.gtmOnFailure(); | |
}); |
This file contains hidden or 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 | |
const JSON = require('JSON'); | |
const sendHttpRequest = require('sendHttpRequest'); | |
sendHttpRequest('https://api.openweathermap.org/data/2.5/weather?lat=52.3746027&lon=6.6810724&appid=[enter_api_key_here]&units=metric&lang=nl', (statusCode, headers, response) => { | |
response = JSON.parse(response); | |
// Do something with the response. |
NewerOlder