Skip to content

Instantly share code, notes, and snippets.

View janhenriklambrechts's full-sized avatar
Hiring talented full-stack engineers

Jan-Henrik Lambrechts janhenriklambrechts

Hiring talented full-stack engineers
View GitHub Profile
@janhenriklambrechts
janhenriklambrechts / checkout.html
Last active November 8, 2022 18:17
Correct Purchase Event Tracking
// Script that tracks Purchase events at Shopify checkout to forward in GTM
// From GTM it can be sent to Google Ads, where Google Ads will process currency conversion
// However, ~20% of events will be blocked by ad-blockers, if you want to capture all events you will need a tool like Converge
// Contact me at jan [at] runconverge [dot] com to learn more.
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "purchase",
@janhenriklambrechts
janhenriklambrechts / max_metric.py
Created March 12, 2021 09:34
MaxMetric for tracking the maximum value of a scalar or tensor in Pytorch-Lightning
import torch
from pytorch_lightning.metrics import Metric
from pytorch_lightning.utilities.distributed import gather_all_tensors
from pytorch_lightning.metrics import Accuracy
class MaxMetric(Metric):
"""
Pytorch-Lightning Metric that tracks the maximum value of a scalar/tensor across an experiment
"""