Skip to content

Instantly share code, notes, and snippets.

View ju1's full-sized avatar

ju1

View GitHub Profile
<script id="gtm-jq-ajax-listen" type="text/javascript">
(function() {
'use strict';
var $;
var n = 0;
init();
function init(n) {
@ju1
ju1 / cookiebotGDPRConsentRecipe.json
Last active January 31, 2020 21:08
CookieBot GDPR recipe for GTM
{
"exportFormatVersion": 2,
"exportTime": "2020-01-31 21:08:03",
"containerVersion": {
"path": "accounts/471432256/containers/9242444/versions/0",
"accountId": "471432256",
"containerId": "9242444",
"containerVersionId": "0",
"container": {
"path": "accounts/471432256/containers/9242444",
@ju1
ju1 / contactForm7Recipe.json
Created June 26, 2018 21:18
Contact Form 7 Trackinng Recipe for Google Tag Manager
{
"exportFormatVersion": 2,
"exportTime": "2018-06-26 21:18:24",
"containerVersion": {
"path": "accounts/1164259306/containers/9334659/versions/0",
"accountId": "1164259306",
"containerId": "9334659",
"containerVersionId": "0",
"container": {
"path": "accounts/1164259306/containers/9334659",
@ju1
ju1 / Sample top bar
Last active April 29, 2024 18:17
Demo bar
<style type="text/css">
#bn-bar {
-moz-transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
-transition: all 0.5s ease;
position: fixed;
-webkit-transform: translateZ(0);
width: 100%;
height: 40px;
line-height:40px;
@ju1
ju1 / gdrpCookieConsentGTMRecipePatch20180614.json
Created June 14, 2018 13:06
GDPR Cookie Consent Notification Recipe Patch for Google Tag Manager (2018 June 14th)
{
"exportFormatVersion": 2,
"exportTime": "2018-06-14 13:05:51",
"containerVersion": {
"path": "accounts/1164259306/containers/9256170/versions/0",
"accountId": "1164259306",
"containerId": "9256170",
"containerVersionId": "0",
"container": {
"path": "accounts/1164259306/containers/9256170",
@ju1
ju1 / reallyBadGtmContainer
Created June 12, 2018 20:22
An example of bad GTM container with many mistakes and problems
{
"exportFormatVersion": 2,
"exportTime": "2018-06-12 20:21:34",
"containerVersion": {
"path": "accounts/471432256/containers/9242444/versions/0",
"accountId": "471432256",
"containerId": "9242444",
"containerVersionId": "0",
"container": {
"path": "accounts/471432256/containers/9242444",
@ju1
ju1 / popupCode
Created June 10, 2018 20:54
Sample Popup
<!-- BEGIN PRIVY ASYNCHRONOUS WIDGET CODE -->
<script type='text/javascript'>
var _d_site = _d_site || 'ED2E297A28A2B40EA5EB1643';
(function(p, r, i, v, y) {
p[i] = p[i] || function() { (p[i].q = p[i].q || []).push(arguments) };
v = r.createElement('script'); v.async = 1; v.src = 'https://widget.privy.com/assets/widget.js';
y = r.getElementsByTagName('script')[0]; y.parentNode.insertBefore(v, y);
})(window, document, 'Privy');
</script>
<!-- END PRIVY ASYNCHRONOUS WIDGET CODE -->
@ju1
ju1 / cookiePageviewCount
Created June 10, 2018 20:44
Pageview Count Stored in the Cookie
<script>function setCookie(name, value, expires) {
var cookie = name + "=" + value + "; path=/; domain=." + location.hostname.replace(/^www\./i, "");
if (typeof expires !== "undefined") {
var now = new Date();
now.setTime(now.getTime() + expires * 24 * 60 * 60 * 1000);
cookie += "; expires=" + now.toUTCString();
}
document.cookie = cookie;
@ju1
ju1 / cookieSettingScript
Created June 10, 2018 20:33
A script which sets the cookie
<script>
var cookieName = "visitorFromAdwords"; // Name of your cookie
var cookieValue = "true"; // Value of your cookie
var expirationTime = 2592000; // One month in seconds
expirationTime = expirationTime * 1000; // Converts expirationtime to milliseconds
var date = new Date();
var dateTimeNow = date.getTime();
date.setTime(dateTimeNow + expirationTime); // Sets expiration time (Time now + one month)
@ju1
ju1 / gdrpCookieConsentGTMRecipe.json
Last active December 9, 2019 09:48
GDPR Cookie Consent Notification Recipe for Google Tag Manager v1
{
"exportFormatVersion": 2,
"exportTime": "2019-09-20 14:30:26",
"containerVersion": {
"path": "accounts/1164259306/containers/9071728/versions/0",
"accountId": "1164259306",
"containerId": "9071728",
"containerVersionId": "0",
"container": {
"path": "accounts/1164259306/containers/9071728",