Skip to content

Instantly share code, notes, and snippets.

View pandectesio's full-sized avatar

pandectes pandectesio

View GitHub Profile
@pandectesio
pandectesio / pandectes-v2.ts
Last active December 15, 2025 10:11
window.Pandectes v2 global object
type Config = any;
interface Consent {
preferences: undefined | boolean;
analytics: undefined | boolean;
marketing: undefined | boolean
}
interface Pandectes {
@pandectesio
pandectesio / extract-consent.js
Last active November 20, 2025 16:09
Read pandectes cookie & consent extract
@pandectesio
pandectesio / pandectes-analytics-strict-eu-only.js
Created July 10, 2025 13:19
Pandectes Analytics: consent mode applies by default strict settings only for EU
/* START_MODIFY_FOR_YOUR_STORE */
/*
* Separate with commas if more than one
*/
const GA4_IDS = "";
const AW_IDS = "";
/*
* Allow for sending data to the debug console of analytics.
* Only use for a short time to test the implementation.
* Leaving on will not allow events to be included in standard reports.
@pandectesio
pandectesio / pandectes-analytics-strict-non-us.js
Created July 10, 2025 13:15
Pandectes Analytics: consent mode applies by default strict settings everywhere except for US.
/* START_MODIFY_FOR_YOUR_STORE */
/*
* Separate with commas if more than one
*/
const GA4_IDS = "";
const AW_IDS = "";
/*
* Allow for sending data to the debug console of analytics.
* Only use for a short time to test the implementation.
* Leaving on will not allow events to be included in standard reports.
@pandectesio
pandectesio / pandectes-analytics-strict.js
Last active July 10, 2025 13:11
Pandectes Analytics: consent mode applies by default strict settings everywhere.
/* START_MODIFY_FOR_YOUR_STORE */
/*
* Separate with commas if more than one
*/
const GA4_IDS = "";
const AW_IDS = "";
/*
* Allow for sending data to the debug console of analytics.
* Only use for a short time to test the implementation.
* Leaving on will not allow events to be included in standard reports.
@pandectesio
pandectesio / Pandectes_Consent_Update_custom_pixel.js
Last active July 2, 2025 07:19
Pandectes_Consent_Update custom event used within Shopify custom pixel
@pandectesio
pandectesio / reopen-fix.js
Last active April 30, 2025 08:36
Fixs #reopenBanner logic if it does not work
function initializeReopenTrigger() {
const reopenTrigger = document.querySelectorAll('[href*="#reopenBanner"]');
if (reopenTrigger.length > 0 && window.Pandectes && window.Pandectes.fn && typeof window.Pandectes.fn.revokeConsent === 'function') {
reopenTrigger.forEach((el) => {
el.onclick = function (e) {
e.preventDefault();
window.Pandectes.fn.revokeConsent();
};
});
@pandectesio
pandectesio / force-accept-all-cookies.js
Last active October 15, 2024 09:57
Sends forced consent signal on Shopify
window.Shopify.loadFeatures(
[
{
name: 'consent-tracking-api',
version: '0.1',
},
],
() => {
window.Shopify.customerPrivacy.setTrackingConsent(
{
@pandectesio
pandectesio / pandectes-pixel-gtag-purchase-only.js
Last active October 18, 2024 09:57
Purchase event on checkout
/*
* DISCLAIMER:
* This example code is provided "as is" and for demonstration purposes only.
* It is intended to serve as a starting point for developers and may contain bugs or errors.
* The author or distributor of this code makes no warranties or representations of any kind concerning the safety,
* suitability, inaccuracies, typographical errors, or other harmful components of this code.
* There is no guarantee that this code is free of defects or bugs.
*
* Please note that this code is subject to change without prior notice.
* Users are encouraged to review the code regularly for any updates or changes.
@pandectesio
pandectesio / pandectes-hello-retail.html
Last active October 10, 2024 11:38
Hello retail tracking support
<!-- Add the following lines of code just above </head> in your HTML. HelloRetail will not track any users -->
<script async src="https://helloretailcdn.com/helloretail.js"></script>
<script>
window.hrq = window.hrq || [];
hrq.push(['init', {
trackingOptOut: true
}]);
window.addEventListener('PandectesEvent_OnConsent', function(params){
if (params && params.detail) {
hrq.push(["setTrackingOptOut", (params.detail.preferences & 4) === 4]);