Navigation Menu

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 / links-with-keywords.html
Created March 7, 2024 11:01
Tracking links with specific keywords in the URL.
@Kugelschieber
Kugelschieber / internal-links.js
Last active February 7, 2024 10:27
Tracking internal links using custom events
@Kugelschieber
Kugelschieber / index.html
Last active December 2, 2023 17:10
Pirsch Vimeo Video Tracking Demo
<!DOCTYPE html>
<html>
<head>
<title>Vimeo Pirsch Demo</title>
<!-- Add the Pirsch extended script to support page views and events. -->
<script defer src="https://api.pirsch.io/pirsch-extended.js"
id="pirschextendedjs"
data-code="YOUR_PIRSCH_CODE"></script>
@Kugelschieber
Kugelschieber / index.html
Last active December 2, 2023 17:10
Pirsch YouTube Video Tracking Demo
<!DOCTYPE html>
<html>
<head>
<title>YouTube Pirsch Demo</title>
<!-- Add the Pirsch extended script to support page views and events. -->
<script defer src="https://api.pirsch.io/pirsch-extended.js"
id="pirschextendedjs"
data-code="YOUR_PIRSCH_CODE"></script>
@Kugelschieber
Kugelschieber / code.gs
Created May 12, 2023 13:04
Pirsch Analytics Google Sheets API Integration
const PIRSCH_CLIENT_ID = ScriptProperties.getProperty('client_id');
const PIRSCH_CLIENT_SECRET = ScriptProperties.getProperty('client_secret');
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu("Pirsch Analytics")
.addItem('Get Visitors', 'pasteVisitorsToSheet')
.addToUi();
}
@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;
@Kugelschieber
Kugelschieber / pirsch-event-cookie.js
Created February 25, 2023 00:36
Send an event once to Pirsch
@Kugelschieber
Kugelschieber / pirsch-api.md
Last active April 12, 2024 11:58
Sending a Page View to Pirsch Using the API

Getting an Access Token

This step is only required if you use a client ID + secret. A single access key allows you to skip the step, but it cannot be used to read statistics as with the other method. For write-only clients, we recommend using an access key.

Replace the CLIENT_ID and CLIENT_SECRET in the body. The access token in the response will be valid for 15 minutes.

curl --location --request POST 'https://api.pirsch.io/api/v1/token' \
--header 'Content-Type: application/json' \
--data-raw '{
@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 (

Pirsch reading statistics example using the API

Step 0

Create a client ID and secret on the developer settings page and save the secret for later use.

Step 1

Get a temporary access token.