Skip to content

Instantly share code, notes, and snippets.

View loldenburg's full-sized avatar

Lukas Oldenburg loldenburg

View GitHub Profile
@loldenburg
loldenburg / 0_reuse_code.js
Created July 28, 2016 19:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
window.utagQ = window.utagQ || {},
utagQ.q = [], // the queue Array
utagQ.view = function (payload) {
utagQ.q.push({hit: "view", data: payload});
},
utagQ.link = function (payload) {
utagQ.q.push({hit: "link", data: payload});
};
utagQ.view({
virtualPageView: "y",
page: {
title: "the new document title",
language: "fr"
},
url: "https://yoursite.com/de/theNewVirtualURL?query=somevalue",
user_loggedin: "n"
});
// This code needs to be implemented inside of Tealium!
// Make this your first DOM Ready Extension
// redefine queue functions to now fire normal utag.view / utag.link calls
if (window.utagQ) {
utagQ.view = function (payload) {
utag.view(payload)
};
utagQ.link = function (payload) {
utag.link(payload)
};
const claimRequest = require('claimRequest');
const getRequestBody = require('getRequestBody');
const getRequestPath = require('getRequestPath');
const getRequestQueryParameters = require('getRequestQueryParameters');
const getTimestamp = require('getTimestampMillis');
const returnResponse = require('returnResponse');
const setResponseBody = require('setResponseBody');
const setResponseStatus = require('setResponseStatus');
const getRequestMethod = require('getRequestMethod');
const getContainerVersion = require('getContainerVersion');
import os
from asyncio import Future
import json
from typing import Dict
from flask import Request
from google.cloud import pubsub
from firestore.reference import FireRef
publish_client = pubsub.PublisherClient()
def pubsub_stitcher(request: Request):
@loldenburg
loldenburg / utagLoader-debug-enabled
Last active October 30, 2021 13:45
Tealium utagLoader Template which outputs Data Layer to console before Pre-Loader and as sent in utag.view/utag.link payload
//tealium universal tag - utag.loader ut4.48.##UTVERSION##, Copyright ##UTYEAR## Tealium.com Inc. All Rights Reserved.
// ATTENTION WHEN UPDATING THIS TEMPLATE!!
// CONTAINS CUSTOM CHANGES TO TEMPLATE (search for // CHANGE)!!
// CHANGE - Add TMSHelper Debugging Output
/**
* To start debug output to your console, open your browser console and run:
* TMSHelper.dbgActivate();
* A cookie "teal_dbg" will be created. To stop debug output, delete that cookie
*/
/* Prerequisites:
MOCHA JS and CSS and CHAI JS Libraries must have loaded prior to this script
*/
/* uncommenting the next row disables the test output to the console,
eg if you want to see the results visually in the browser window.
For this, a DIV with an id="mocha" must have been inserted into the page.
*/
mocha.reporter(mocha.WebKit);
@loldenburg
loldenburg / performance_metrics.js
Last active July 12, 2023 09:42
Generic Performance Metrics for TMS-based Web Analytics Tracking Implementations
/* 1. Metrics to monitor the general page loading performance. I call them "poor man's page performance metrics",
because they are the minimum you should do in terms of page performance measurement in your Analytics:
a) Time from starting to navigate to page until Server Response time:
While this does not represent perfectly if the server does its job, it is a good enough proxy
to "how long did the user see nothing" after clicking to the page and usually does indicate server response issues.
b) Time until DOM became interactive: A close equivalent to the good old "DOM Ready" event.
It shows the time when the document has been fully parsed, so that still happens before your hopefully async TMS library is loaded.