Skip to content

Instantly share code, notes, and snippets.


Markus Baersch mbaersch

View GitHub Profile
mbaersch / full_size_gtm.user.js
Created Sep 22, 2022
Tampermonkey Script for adjusting GTM user interface to full size use
View full_size_gtm.user.js
// ==UserScript==
// @name Full Size GTM
// @namespace
// @version 0.1
// @description adjust GTM user interface to full size use
// @author MBSL
// @match*
// @icon
// @grant none
// ==/UserScript==
mbaersch / kill_ga4_announcement.user.js
Last active Aug 27, 2022
Tampermonkey Script: hide annoying announcement for GA4 in Universal Analytics UI
View kill_ga4_announcement.user.js
// ==UserScript==
// @name Kill GA4 Announcement
// @namespace
// @version 0.4
// @description hide annoying announcement for GA4 in Universal Analytics UI (or any other)
// @author MBSL
// @match*
// @icon
// @grant none
// ==/UserScript==
mbaersch / Universal-Export-R-Beispiel.R
Last active May 2, 2022
Beispielscript zum Export von Daten aus Google Universal Analytics mittels R
View Universal-Export-R-Beispiel.R
# Beispielscript: Export von Daten aus Google Universal Analytics mittels R
# Dieses Beispiel gehört zum Blogpost unter
# Damit es nutzbar ist:
# - R installieren:
# - RStudio installieren:
# - Dieses Script in RStudio öffnen
mbaersch / getgtm.php
Last active Mar 18, 2022
Local caching helper for GTM containers
View getgtm.php
Helper for locally cached GTM container: update local GTM cache and
enable optional live container loading for debugging
//path and filename for local GTM container cache, relative
//to this PHP file or as absolute server path
$gtm_save_path = "../js/gtm.js";
mbaersch / content-visibility-marker.html
Created Nov 23, 2021
Custom HTML Tag for Google Tag Manager to create markers in main content for triggering "content consumption" events
View content-visibility-marker.html
This code can be used as a Custom HTML tag in Google Tag Manager to create invisible "marker lines"
every x percent inside a container (selected via CSS selector) that holds the main content of a page
(like a blog post).
You can then use visibility triggers for the marker lines (selected by name or class) in GTM in order
to fire event tags for Google Analytics or any other tool to measure "content consumption" without
having to rely inaccurate scroll tracking.
mbaersch / timed-visibility-observer.html
Last active Jun 9, 2022
Timed Visibility Observer - HTML-Tag für Piwik PRO Tag Manager zur zeitgesteuerten Auslösung von Visibility Trigger Events
View timed-visibility-observer.html
//HTML-Tag für Piwik PRO Tag Manager zur zeitgesteuerten Auslösung von Visibility Trigger Events.
//Hinweise siehe
//Die Funktion minimalReadingTime() kann entfernt werden, wenn feste Zeiten oder keine Mindestdauer
//benötigt wird. Ebenso kann dieser Kommentar entfernt werden, um nicht die Ladezeit des Tag Managers
mbaersch / fix-ecjs-client.tpl
Created Oct 13, 2021
fix to fulfil requests for ec.js from a server-side GTM endpoint (Custom Client Template)
View fix-ecjs-client.tpl
"type": "CLIENT",
"id": "cvt_temp_public_id",
"version": 1,
"securityGroups": [],
"displayName": "Fix ec.js",
"brand": {
"id": "brand_dummy",
mbaersch / cached_event_id.js
Last active Nov 4, 2021
getUniqueEventId() - creates cacheable event ids for deduplication of events that cannot use the same trigger
View cached_event_id.js
/* create unique event ids for specific events that "live" for a limited time
(default: 1 scond).
returns a value that consist of the key, a random number and a timestamp;
dot-separated. An existing value for a key that is requested within the
defined lifespan will remain the same, otherwise (not existing or too old)
a new value is generated and stored. The limited lifespan can be used to
deduplicate several hits of the same type between page loads (e. g. Add2Cart
or multiple PageViews in SPAs).
mbaersch / enhance_ga4_event_builder.js
Last active Sep 6, 2022
Tampermonkey script to add a new section to the GA4 Event Builder for sending payloads to a custom endpoint
View enhance_ga4_event_builder.js
// ==UserScript==
// @name Enhance GA4 Event Builder
// @namespace
// @version 0.2
// @description add option to send payload to a custom endpoint instead of
// @author Markus Baersch
// @match
// @grant none
// ==/UserScript==
View Consent Mode Configuration (Demo).tpl