Skip to content

Instantly share code, notes, and snippets.


Markus Baersch mbaersch

View GitHub Profile
mbaersch / this-or-that.tpl
Created Apr 3, 2021
This Or That (Server-Side Google Tag Manager Custom Variable Template)
View this-or-that.tpl
"type": "MACRO",
"id": "cvt_temp_public_id",
"version": 1,
"securityGroups": [],
"displayName": "This Or That",
"description": "define multiple variables and get the first unset value as result",
"containerContexts": [
mbaersch / store_fbc_cookie.js
Created Mar 22, 2021
HTML tag code for persiting a fblid as cookie in client-side Google Tag Manager
View store_fbc_cookie.js
mbaersch / 200qapla.tpl
Last active Mar 20, 2021
sending debugging hits to your serverside GTM endpoint from the browser manually? make every request a glorious success. I bet you get the joke.
View 200qapla.tpl
"type": "CLIENT",
"id": "cvt_temp_public_id",
"version": 1,
"securityGroups": [],
"displayName": "200 Qapla\u0027",
"brand": {
"id": "brand_dummy",
mbaersch / piwikpro-resize-tagcode.html
Last active Mar 26, 2021
PiwikPro Tag Manager Debug Resize
View piwikpro-resize-tagcode.html
adds 200px width to the PiwikPro Tag Manager debug panel and creates links (at top right) to enhance or decrease with in 200 pixel steps
usage: create new (async) html tag in PiwikPro Tag Manager, paste this code and fire tag on DOM ready, if "Preview Mode" is "1".
get preview status from stg_debug cookie as there is no built in variable for debug status (afaik)
function ppResizeDebug(w) {
var pnl = document.querySelector("#seventag_container_debugger");
mbaersch / konamicode-easteregg.js
Last active Feb 19, 2021
Konami code easter egg for websites
View konamicode-easteregg.js
/*Animate element and change text / html if konami code is entered on a page - can be used as custom HTML in Google Tag Manager.
Source / idea: */
/* SETUP */
//message to display on "konami element" after animation. HTML can be used as well - innerHTML will be replaced with whatever gets defined here.
//leave blank for no change (just animation)
var konamiMessage = 'you are awesome! ;)</small>';
//CSS Selector for element to animate and display message (e.g. "#someId", "div.someclass". info:
mbaersch / Demo-Client.tpl
Created Sep 8, 2020
Serverside GTM Demo Client + Tag Template
View Demo-Client.tpl
"type": "CLIENT",
"id": "cvt_temp_public_id",
"version": 1,
"securityGroups": [],
"displayName": "Demo Logger",
"brand": {
"id": "brand_dummy",
mbaersch / matomo-resize-tagcode.html
Last active Mar 13, 2021
adjust size of Matomo Tag Manager preview / debug console
View matomo-resize-tagcode.html
//use this script to adjust size of Matomo Tag Manager preview / debug console
//usage: create html tag in MTM, paste this code and fire tag on DOM ready, if "Preview Mode" is "1"
var mtmPreviewSize;
//resize MTM preview via console
function resizeMtmPreview(prz) {
//only in preview mode
if ({{PreviewMode}}) {
var mtm = document.querySelector('iframe#mtmDebugFrame');
View clientcode.js
//Alle APIs, die wir zum Lesen, Verarbeiten und Weitergeben brauchen, werden hier geladen
const claimRequest = require('claimRequest');
const returnResponse = require('returnResponse');
const getRequestQueryParameter = require('getRequestQueryParameter');
const runContainer = require('runContainer');
const setPixelResponse = require('setPixelResponse');
const getRequestHeader = require('getRequestHeader');
const getRequestPath = require('getRequestPath');
const getRemoteAddress = require('getRemoteAddress');
mbaersch / gaproxy.php
Last active Aug 17, 2020
simple PHP proxy for Google Analytics hits
View gaproxy.php
//send hits to GA- or GTM tag-server: use this file via transport_url
//more info:
//define destination for tracking hits - either on
//or own tag server like or
// :
$endpoint = "";
mbaersch / functions.php
Created Mar 25, 2020
send serverside conversions from a Wordpress shop (e. g. wooCommerce) to Google Analytics
View functions.php
// add one of the two following options to the functions.php of your child theme in order to send server side
// conversion data to Google Analytics
// NOTE: function store_gclid() is used by both variants
// send conversion to Analytics - Option 1: track success page as only pageview in the session and
// create a goal for path "/conversion/"
// adjust goal path (fragment) in $goalurl in order to fit your url structure
// comment out line below to deactivate