Skip to content

Instantly share code, notes, and snippets.

View Kugelschieber's full-sized avatar
💭
Working on Pirsch

Marvin Blum Kugelschieber

💭
Working on Pirsch
View GitHub Profile
@Kugelschieber
Kugelschieber / copy_gcs_bucket_to_minio.go
Last active December 22, 2019 13:03
This little Go application will copy everything from one Google Cloud Storage Bucket to a MinIO Bucket. You'll need a GCS credentials file and a MinIO access key + secret.
package main
import (
"cloud.google.com/go/storage"
"context"
"github.com/minio/minio-go"
"google.golang.org/api/iterator"
"log"
"os"
)
@Kugelschieber
Kugelschieber / golang_timer_example.go
Created January 25, 2021 18:42
Example for running a timed function call in Golang without leaking the goroutine
package main
import (
"context"
"fmt"
"log"
"time"
)
func runTimed(tick time.Duration, f func()) context.CancelFunc {
@Kugelschieber
Kugelschieber / pirsch-get-domain.js
Last active February 18, 2022 12:53
List the Pirsch client domain.
var { Client } = require("pirsch-sdk");
var client = new Client({
hostname: "your-domain", // don't forget to set these!
clientID: "your-client-id",
clientSecret: "your-client-secret"
});
client.domain()
.then(d => {
(function() {
"use strict";
if(navigator.doNotTrack === "1" || localStorage.getItem("disable_pirsch")) {
return;
}
const script = document.querySelector("#pirschjs");
const endpoint = script.getAttribute("data-endpoint") || "https://api.pirsch.io/hit";
const identificationCode = script.getAttribute("data-code");
(function() {
"use strict";
window.pirsch = (name, options) => {
console.log(`Pirsch event: ${name}${options ? " "+JSON.stringify(options) : ""}`);
return Promise.resolve(null);
};
if(navigator.doNotTrack === "1" || localStorage.getItem("disable_pirsch")) {
return;
@Kugelschieber
Kugelschieber / pirsch-no-script-tag.js
Created September 17, 2022 10:40
A custom pirsch.js without the requirement for a script tag in the header section.
(function () {
"use strict";
// The identification code for your website from the settings page.
// Required.
const identificationCode = "";
// A comma-separated list of path patterns (regular expressions) to include.
// Optional.
const includePaths = "";
@Kugelschieber
Kugelschieber / Caddyfile
Last active October 5, 2022 14:12
Pirsch Go Proxy Setup
# Uncomment everything not specified here and change the domain.
proxy.yourdomain.com:443 {
reverse_proxy localhost:8080
}
@Kugelschieber
Kugelschieber / otto-test.go
Created January 25, 2023 15:35
Otto JS Test in Go
package main
import (
"log"
"time"
"github.com/robertkrimen/otto"
)
const (
@Kugelschieber
Kugelschieber / pirsch-event-cookie.js
Created February 25, 2023 00:36
Send an event once to Pirsch
@Kugelschieber
Kugelschieber / index.html
Created April 19, 2023 09:55
Track scroll position on an article using Pirsch Analytics
<!DOCTYPE html>
<html>
<head>
<title>Reading Percentage Demo</title>
<style type="text/css">
body {
max-width: 800px;
padding: 40px;
margin: 0 auto;
font-family: sans-serif;