### PostHog Redirect Rule Initialization Source: https://www.immy.bot/documentation/gettingstarted/instance-onboarding Initializes PostHog redirect rules, starting the check process if debug mode is enabled. ```javascript if (isDebugMode) { console.log('PostHog Redirects: No matching variants found, staying on current page'); } }); } // Start checking for redirects checkRedirectRules(); })(); ``` -------------------------------- ### PostHog Redirects: Debugging and Cookie Update Logic Source: https://www.immy.bot/technicians This snippet handles the initial setup and cookie updates for PostHog redirects. It logs detailed information when in debug mode and ensures cookies are updated before checking redirect rules. It also includes troubleshooting steps for when no rules match the current path. ```javascript console.log("PostHog Redirects: Updated cookie for flag '" + flagName + "' from '" + existingValue + "' to '" + flagValue + "'"); } } else if (isDebugMode) { console.log("PostHog Redirects: Cookie for flag '" + flagName + "' already current with variant '" + flagValue + "'"); } } } } }); } // Always update cookies updateAllCookies(); // If no matching rules for current path, exit after updating cookies if (rules.length === 0) { if (isDebugMode) { console.log('PostHog Redirects: No rules match current path, no redirects will be attempted'); console.log('PostHog Redirects: TROUBLESHOOTING:'); console.log(' 1. Check that you have redirect rules configured in WordPress admin'); console.log(' 2. Verify the "From path" exactly matches the current URL path'); console.log(' 3. Ensure the redirect rule is enabled (toggle switch on)'); console.log(' 4. Remember paths are case-sensitive and should not include domain'); } return; } ``` -------------------------------- ### EnlighterJS Initialization Configuration Source: https://www.immy.bot/community-calls/community-call-may-2026 Configuration object for initializing EnlighterJS, a syntax highlighting library, specifying selectors and options. ```javascript var o={"selectors":{"block":"pre.EnlighterJSRAW","inline":"code.EnlighterJSRAW"},"options":{"indent":4,"ampersandCleanup":true,"linehover":false,"rawcodeDbclick":false,"textOverflow":"break","linenumbers":true,"theme":"wpcustom","language":"generic","retainCssClasses":false,"collapse":false,"toolbarOuter":"","toolbarTop":"{BTN_RAW}{BTN_COPY}{BTN_WINDOW}{BTN_WEBSITE}","toolbarBottom":""}}; ``` -------------------------------- ### Initialize Emoji Settings and Support Tests Source: https://www.immy.bot/msp-owner Parses emoji settings from the DOM and initiates support tests. Stores results in sessionStorage for caching. ```javascript const a=JSON.parse(document.getElementById("wp-emoji-settings").textContent),o=(window._wpemojiSettings=a,"wpEmojiSettingsSupports"),s=["flag","emoji"];function i(e){try{var t={supportTests:e,timestamp:(new Date).valueOf()};sessionStorage.setItem(o,JSON.stringify(t))}catch(e){}}function c(e,t,n){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);t=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data);e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(n,0,0);const a=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data);return t.every((e,t)=>e===a[t])}function p(e,t){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);var n=e.getImageData(16,16,1,1);for(let e=0;e{s[e]=t(o,e,n,a)}),s}function r(e){var t=document.createElement("script");t.src=e,t.defer=!0,document.head.appendChild(t)}a.supports={everything:!0,everythingExceptFlag:!0},new Promise(t=>{let n=function(){try{var e=JSON.parse(sessionStorage.getItem(o));if("object"==typeof e&&"number"==typeof e.timestamp&&(new Date).valueOf(){i(n=e.data),r.terminate(),t(n)})}catch(e){}i(n=f(s,u,c,p))}t(n)}).then(e=>{for(const n in e)a.supports[n]=e[n],a.supports.everything=a.supports.everything&&a.supports[n],"flag"!==n&&(a.supports.everythingExceptFlag=a.supports.everythingExceptFlag&&a.supports[n]);var t;a.supports.everythingExceptFlag=a.supports.everythingExceptFlag&&!a.supports.flag,a.supports.everything||((t=a.source||{}).concatemoji?r(t.concatemoji):t.wpemoji&&t.twemoji&&(r(t.twemoji),r(t.wpemoji)))}); //# sourceURL=https://www.immy.bot/wp-includes/js/wp-emoji-loader.min.js ``` -------------------------------- ### General Code Block Styling Source: https://www.immy.bot/documentation/core-features Provides styling for general code blocks, including padding, margins, font, and background color. Ensures readability for longer code examples. ```css code { display: block; clear: both; overflow: auto; padding: 1.6em; margin-bottom: 1.6em; white-space: pre; background-color: #f0f0f0; font: 14px "Source Code Pro","Liberation Mono","Courier New",monospace; white-space:normal; } ``` -------------------------------- ### Initialize and Check Redirect Rules Source: https://www.immy.bot/how-it-works This snippet initializes redirect checks and logs matching rules. It's used to determine if any redirects should be attempted based on the current path. ```javascript console.log('PostHog Redirects: Matching rules for current path:', rules.length); if (rules.length > 0) { console.log('🎯 MATCH FOUND! Rules that match current path:', rules); console.log('PostHog Redirects: Will now check PostHog feature flags using recommended onFeatureFlags approach...'); } else { console.log('📍 PostHog Redirects: No rules match current path, no redirects will be attempted'); } ``` -------------------------------- ### Blog Post Styling Source: https://www.immy.bot/how-it-works CSS for blog post elements, including hiding the loop start, styling post headings, setting max-width for content on pages without sidebars, and styling blockquotes. ```css /*------------ Blog ------------*/ .nectar_before_blog_loop_start { display: none !important; } h3.post-heading { font-size: 28px !important; } body.single-post #ajax-content-wrap .container-wrap.no-sidebar .post-area, .single-post .featured-media-under-header__content { max-width: 1200px; } blockquote { font-family: 'Outfit'; font-style: italic; font-weight: 800; line-height: 34px; font-size: 22px; letter-spacing: .5px; margin-bottom: 30px; } .wpb_text_column blockquote p { color: #fff !important; } .material blockquote::before { border-color: #01EAD1 !important; } .wpb_video_wrapper iframe { border-radius: 20px; } .masonry.material .masonry-blog-item .article-content-wrap, .masonry.material .masonry-blog-item h3 { color: #fff; background-color: transparent; } .masonry.material .masonry-blog-item .article-content-wrap { padding: 30px 0 0 0 !important; } .masonry-blog-item { margin-bottom: 20px; } .masonry-blog-item .content-inner .post-featured-img img { border-radius: 20px; } .blogsidebar .wpb_text_column { border: 3px solid #666; border-r ``` -------------------------------- ### Handle No Matching Redirect Rules Source: https://www.immy.bot/documentation/psa-integrations/halo-integration-setup This JavaScript snippet logs troubleshooting information when no redirect rules match the current path. It guides the user to check rule configuration, path matching, and rule enablement in the WordPress admin. This is executed if the 'rules' array is empty. ```javascript // If no matching rules for current path, exit after updating cookies if (rules.length === 0) { if (isDebugMode) { console.log('PostHog Redirects: No rules match current path, no redirects will be attempted'); console.log('PostHog Redirects: TROUBLESHOOTING:'); console.log(' 1. Check that you have redirect rules configured in WordPress admin'); console.log(' 2. Verify the "From path" exactly matches the current URL path'); console.log(' 3. Ensure the redirect rule is enabled (toggle switch on)'); console.log(' 4. Remember paths are case-sensitive and should not include domain'); } return; } ``` -------------------------------- ### EnlighterJS Syntax Highlighter Initialization Source: https://www.immy.bot/documentation/gettingstarted This script initializes the EnlighterJS syntax highlighter. It defines selectors for code blocks and inline code, and configures options such as indentation, line numbers, theme, and toolbar buttons. This code should run after EnlighterJS resources are loaded. ```javascript !function(e,n){if("undefined"!=typeof EnlighterJS){var o={"selectors":{"block":"pre.EnlighterJSRAW","inline":"code.EnlighterJSRAW"},"options":{"indent":4,"ampersandCleanup":true,"linehover":false,"rawcodeDbclick":false,"textOverflow":"break","linenumbers":true,"theme":"wpcustom","language":"generic","retainCssClasses":false,"collapse":false,"toolbarOuter":"","toolbarTop":"{BTN_RAW}{BTN_COPY}{BTN_WINDOW}{BTN_WEBSITE}","toolbarBottom":""}};(e.EnlighterJSINIT=function(){EnlighterJS.init(o.selectors.block,o.selectors.inline,o.options)})}else{(n&&(n.error||n.log)||function(){})("Error: EnlighterJS resources not loaded yet!")}}(window,console); //# sourceURL=enlighterjs-js-after ``` -------------------------------- ### PostHog Feature Flag Cookie Update Logic Source: https://www.immy.bot/customer-testimonial/justin-schowalter-cto-blade-technologies This function ensures that cookies are updated for all active PostHog feature flags, even if no specific redirect rules match the current path. It uses `posthog.onFeatureFlags` to get active flags and creates or updates corresponding cookies. ```javascript const allRules = [{"from":"\/pricing\/","to":"\/plans-form\/","flag":"pricing-experiment---oct-2025","variant":"test","enabled":0}]; function updateAllCookies() { if (typeof posthog === 'undefined') { if (isDebugMode) { console.log('PostHog Redirects: PostHog not available yet for cookie update...'); } setTimeout(updateAllCookies, 50); // Reduced delay for faster response return; } posthog.onFeatureFlags(function(flags, flagVariants) { if (isDebugMode) { console.log('PostHog Redirects: Processing cookies for all active PostHog feature flags...'); console.log('PostHog Redirects: All active flags from PostHog:', flagVariants); } if (flagVariants && typeof flagVariants === 'object') { for (const [flagName, flagValue] of Object.entries(flagVariants)) { if (flagValue !== null && flagValue !== undefined) { const cookieName = `posthog_variant_${flagName}`; const existingCookie = document.cookie .split('; ') .find(row => row.startsWith(cookieName + '=')); const expirationDate = new Date(); expirationDate.setTime(expirationDate.getTime() + (24 * 60 * 60 * 1000)); if (!existingCookie) { document.cookie = `${cookieName}=${flagValue}; expires=${expirationDate.toUTCString()}; path=/`; if (isDebugMode) { console.log(`PostHog Redirects: Created cookie for flag '${flagName}' with variant '${flagValue}' (first visit)`); } } else { const existingValue = existingCookie.split('=')[1]; if (existingValue !== flagValue) { document.cookie = `${cookieName}=${flagValue}; expires=${expirationDate.toUTCString()}; path=/`; if (isDebugMode) { console.log(`PostHog Redirects: Updated cookie for flag '${flagName}' from '${existingValue}' to '${flagValue}'`); } } else if (isDebugMode) { console.log(`PostHog Redirects: Cookie for flag '${flagName}' already current with variant '${flagValue}'`); } } } } } }); } updateAllCookies(); if (rules.length === 0) { if (isDebugMode) { console.log('PostHog Redirects: No rules match curr'); } } ``` -------------------------------- ### Troubleshooting: No Matching Rules for Current Path Source: https://www.immy.bot/documentation/basic-instance-management/schedules This code block provides troubleshooting guidance when no redirect rules match the current path. It suggests checking rule configuration in WordPress, verifying path matching (case-sensitivity, domain exclusion), and ensuring the redirect rule is enabled. ```javascript if (rules.length === 0) { if (isDebugMode) { console.log('PostHog Redirects: No rules match current path, no redirects will be attempted'); console.log('PostHog Redirects: TROUBLESHOOTING:'); console.log(' 1. Check that you have redirect rules configured in WordPress admin'); console.log(' 2. Verify the "From path" exactly matches the current URL path'); console.log(' 3. Ensure the redirect rule is enabled (toggle switch on)'); console.log(' 4. Remember paths are case-sensitive and should not include domain'); } return; } ``` -------------------------------- ### EnlighterJS Initialization Call Source: https://www.immy.bot/community-calls/community-call-may-2026 Calls the EnlighterJS initialization function with the specified configuration. ```javascript (e.EnlighterJSINIT=function(){EnlighterJS.init(o.selectors.block,o.selectors.inline,o.options)})() ``` -------------------------------- ### Cloudflare Challenge Platform Initialization Source: https://www.immy.bot/articles/lets-get-it-started This snippet initializes a Cloudflare challenge platform script using an iframe. It dynamically creates an iframe, injects a script into it, and appends the iframe to the document body. It handles DOMContentLoaded and onreadystatechange events to ensure the script runs at the appropriate time. ```javascript (function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a04f85c05ff364a7',t:'MTc4MDMzMDU4Mw=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})(); ``` -------------------------------- ### Check Redirect Rules with PostHog Availability Source: https://www.immy.bot/how-it-works Waits for PostHog to be available and then checks feature flags to determine if redirects should occur. Includes troubleshooting for PostHog loading issues. ```javascript function checkRedirectRules() { // Ensure PostHog is available if (typeof posthog === 'undefined') { if (isDebugMode) { console.log('PostHog Redirects: PostHog not available yet, waiting for it to load...'); console.log('PostHog Redirects: TROUBLESHOOTING:'); console.log(' 1. Make sure PostHog script is loaded before this redirect script'); console.log(' 2. Verify PostHog API key is correctly configured'); console.log(' 3. Check browser console for PostHog loading errors'); } // Retry after a shorter delay for faster response setTimeout(checkRedirectRules, 50); return; } if (isDebugMode) { console.log('PostHog Redirects: PostHog is available, checking feature flags...'); } // Use PostHog's recommended onFeatureFlags approach posthog.onFeatureFlags(function() { if (isDebugMode) { console.log('PostHog Redirects: Feature flags are loaded and ready, checking for redirects...'); } // Check for redirects (cookies already updated above) for (const rule of rules) { if (isDebugMode) { console.log(`PostHog Redirects: Checking flag '${rule.flag}' for variant '${rule.variant}'`); } // Get feature flag value using PostHog's recommended method // This automatically handles overrides transparently const currentVariant = posthog.getFeatureFlag(rule.flag); if (isDebugMode) { console.log(`🔍 PostHog Redirects: Flag '${rule.flag}' - Current: '${currentVariant}', Required: '${rule.variant}', Match: ${currentVariant === rule.variant}`); } if (isDebugMode) { console.log(`PostHog Redirects: Flag '${rule.flag}' value from PostHog: ${currentVariant === null || currentVariant === undefined ? 'null/undefined' : `'${currentVariant}'`} `); console.log(`PostHog Redirects: Required variant: '${rule.variant}' (type: ${typeof rule.variant}) `); console.log(`PostHog Redirects: Current variant: '${currentVariant}' (type: ${typeof currentVaria` } } }); } ``` -------------------------------- ### Initialize Emoji Support Tests Source: https://www.immy.bot/documentation/gettingstarted/instance-onboarding This function sets up the canvas context and font for performing emoji support tests. It iterates through a list of characters to test and stores the results. ```javascript function f(e,t,n,a){let r;const o=(r="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?new OffscreenCanvas(300,150):document.createElement("canvas")).getContext("2d",{willReadFrequently:!0}),s=(o.textBaseline="top",o.font="600 32px Arial",{});return e.forEach(e=>{s[e]=t(o,e,n,a)}),s} ``` -------------------------------- ### Nectar Frontend and Options Configuration Source: https://www.immy.bot/documentation/how-to-guides/basic-instance-management Configuration for the Nectar theme, including AJAX URL, AJAX nonce, and various frontend options for theme behavior and WooCommerce. ```javascript var nectarLove = {"ajaxurl":"https://www.immy.bot/wp-admin/admin-ajax.php","postID":"2701","rooturl":"https://www.immy.bot","disqusComments":"false","loveNonce":"fcea26cf55","mapApiKey":""}; var nectarOptions = {"delay_js":"false","smooth_scroll":"false","smooth_scroll_strength":"50","quick_search":"false","react_compat":"disabled","header_entrance":"false","body_border_func":"default","disable_box_roll_mobile":"false","body_border_mobile":"0","dropdown_hover_intent":"default","simplify_ocm_mobile":"0","mobile_header_format":"default","ocm_btn_position":"default","left_header_dropdown_func":"default","ajax_add_to_cart":"0","ocm_remove_ext_menu_items":"remove_images","woo_product_filter_toggle":"0","woo_sidebar_toggles":"true","woo_sticky_sidebar":"0","woo_minimal_product_hover":"default","woo_minimal_product_effect":"default","woo_related_upsell_carousel":"false","woo_product_variable_select":"default","woo_using_cart_addons":"false","view_transitions_effect":""}; var nectar_front_i18n = {"menu":"Menu","next":"Next","previous":"Previous","close":"Close"}; //# sourceURL=nectar-frontend-js-extra ``` -------------------------------- ### CSS for Blog Layout and Elements Source: https://www.immy.bot/category/articles Styles for blog post headings, content areas, blockquotes, video embeds, and sidebar elements. ```css /*------------ Blog ------------*/ .nectar_before_blog_loop_start{ display:none!important; } h3.post-heading{ font-size:28px!important; } body.single-post #ajax-content-wrap .container-wrap.no-sidebar .post-area, .single-post .featured-media-under-header__content{ max-width:1200px; } } blockquote { font-family: 'Outfit'; font-style:italic; font-weight: 800; line-height: 34px; font-size: 22px; letter-spacing: .5px; margin-bottom: 30px; } .wpb_text_column blockquote p{ color:#fff!important; } .material blockquote::before{ border-color:#01EAD1!important; } .wpb_video_wrapper iframe{ border-radius:20px; } .masonry.material .masonry-blog-item .article-content-wrap, .masonry.material .masonry-blog-item h3{ color:#fff; background-color:transparent; } .masonry.material .masonry-blog-item .article-content-wrap{ padding:30px 0 0 0!important; } .masonry-blog-item{ margin-bottom:20px; } .masonry-blog-item .content-inner .post-featured-img img{ border-radius:20px; } .blogsidebar .wpb_text_column{ border:3px solid #666; border-radius:15px; padding:5px 0 10px 15px; } .blogsidebar ol li a{ color:#fff; font-size:16px; font-weight:400; line-height:1.1!important; text-decoration:none; display:block; } .blogsidebar ol li{ margin-bottom:3px; } .blogsidebar ol li a:hover{ color:#bbb; text-decoration:underline; } @media only screen (min-width: 1000px){ .blogsidebar{ padding-left:0!important; } body.single-post #ajax-content-wrap .container-wrap.no-sidebar .post-area{ max-width:1200px; } } .customerstoryad{ padding:0!important; } .customerstorybio{ border-radius:50%!important; } .nectar-post-grid-filters h ``` -------------------------------- ### CSS for Blog Layout Adjustments Source: https://www.immy.bot/community-calls/community-call-may-2026 Hides the 'nectar_before_blog_loop_start' element and adjusts heading sizes and content width for single posts. ```css /*------------ Blog ------------*/ .nectar-post-grid-filters h4:before, .nectar-post-grid-filters h4:after{ background-color:#fff!important; } .nectar-post-grid-filters a.active{ color:#fff; } .nectar-post-grid-filters a{ color:#ccc; } .nectar-post-grid-filters a::after { content: ''; position: absolute; width: 100%; transform: scaleX(0); height: 2px; bottom: 0; left: 0; background-color: #fff; transform-origin: bottom right; transition: transform 0.25s ease-out; } .nectar-post-grid-filters a:hover::after { transform: scaleX(1); transform-origin: bottom center; } /*------------ End Blog ------------*/ ``` -------------------------------- ### EnlighterJS Initialization Script Source: https://www.immy.bot/category/customer-testimonial This script initializes the EnlighterJS syntax highlighter. It defines selectors for code blocks and inline code, and configures options such as line numbers, theme, and toolbar buttons. ```javascript /* */ ``` -------------------------------- ### CSS for Blog Layout and Navigation Source: https://www.immy.bot/msp-owner Styles for blog elements including post headings, content areas, sidebars, and navigation filters. Also includes styles for sticky elements. ```css .fixedsticky-on .hide-scrollbars { width: 100%!important; overflow: auto!important; } /*------------ Blog ------------*/ .nectar_before_blog_loop_start { display:none!important; } h3.post-heading { font-size:28px!important; } body.single-post #ajax-content-wrap .container-wrap.no-sidebar .post-area, .single-post .featured-media-under-header__content { max-width:1200px; } blockquote { font-family: 'Outfit'; font-style:italic; font-weight: 800; line-height: 34px; font-size: 22px; letter-spacing: .5px; margin-bottom: 30px; } .wpb_text_column blockquote p { color:#fff!important; } .material blockquote::before { border-color:#01EAD1!important; } .wpb_video_wrapper iframe { border-radius:20px; } .masonry.material .masonry-blog-item .article-content-wrap, .masonry.material .masonry-blog-item h3 { color:#fff; background-color:transparent; } .masonry.material .masonry-blog-item .article-content-wrap { padding:30px 0 0 0!important; } .masonry-blog-item { margin-bottom:20px; } .masonry-blog-item .content-inner .post-featured-img img { border-radius:20px; } .blogsidebar .wpb_text_column { border:3px solid #666; border-radius:15px; padding:5px 0 10px 15px; } .blogsidebar ol li a { color:#fff; font-size:16px; font-weight:400; line-height:1.1!important; text-decoration:none; display:block; } .blogsidebar ol li { margin-bottom:3px; } .blogsidebar ol li a:hover { color:#bbb; text-decoration:underline; } @media only screen (min-width: 1000px) { .blogsidebar { padding-left:0!important; } body.single-post #ajax-content-wrap .container-wrap.no-sidebar .post-area { max-width:1200px; } } .customerstoryad { padding:0!important; } .customerstorybio { border-radius:50%!important; } .nectar-post-grid-filters h4:before, .nectar-post-grid-filters h4:after { background-color:#fff!important; } .nectar-post-grid-filters a.active { color:#fff; } .nectar-post-grid-filters a { color:#ccc; } .nectar-post-grid-filters a::after { content: ''; position: absolute; width: 100%; transform: scaleX(0); height: 2px; bottom: 0; left: 0; background-color: #fff; transform-origin: bottom right; transition: transform 0.25s ease-out; } .nectar-post-grid-filters a:hover::after { transform: scaleX(1); transform-origin: bottom center; } /*------------ End Blog ------------*/ ``` -------------------------------- ### Leadin WordPress Initialization Source: https://www.immy.bot/customer-testimonial/justin-schowalter-cto-blade-technologies This JavaScript object 'leadin_wordpress' contains configuration for the Leadin plugin in a WordPress environment. It specifies user role and page type for tracking purposes. ```javascript var leadin_wordpress = { "userRole": "visitor", "pageType": "post", "leadinPluginVersion": "11.3.44" }; ``` -------------------------------- ### Troubleshooting PostHog Redirects Source: https://www.immy.bot/customer-testimonial/jason-slagle-president-cnwr-inc Provides troubleshooting steps for issues with PostHog redirect rules. It suggests checking WordPress admin configuration, URL path matching, rule enablement, and case sensitivity. ```javascript function checkRedirectRules() { // Ensure PostHog is available if (typeof posthog === 'undefined') { if (isDebugMode) { console.log('PostHog Redirects: PostHog not available yet, waiting for it to load...'); console.log('PostHog Redirects: TROUBLESHOOTING:'); console.log(' 1. Make sure PostHog script is loaded before this redirect script'); console.log(' 2. Verify PostHog API key is correctly configured'); console.log(' 3. Check browser console for PostHog loading errors'); } // Retry after a shorter delay for faster response setTimeout(checkRedirectRules, 50); return; } if (isDebugMode) { console.log('PostHog Redirects: PostHog is available, checking feature flags...'); } // Use PostHog's recommended onFeatureFlags approach posthog.onFeatureFlags(function() { if (isDebugMode) { console.log('PostHog Redirects: Feature flags are loaded and ready, checking for redirects...'); } // Check for redirects (cookies already updated above) for (const rule of rules) { if (isDebugMode) { console.log(`PostHog Redirects: Checking flag '${rule.flag}' for variant '${rule.variant}'`); } // Get feature flag value using PostHog's recommended method // This automatically handles overrides transparently const currentVariant = posthog.getFeatureFlag(rule.flag); if (isDebugMode) { console.log(`🔍 PostHog Redirects: Flag '${rule.flag}' - Current: '${currentVariant}', Required: '${rule.variant}', Match: ${currentVariant === rule.variant}`); } if (isDebugMode) { console.log(`PostHog Redirects: Flag '${rule.flag}' value from PostHog: ${currentVariant === null || currentVariant === undefined ? 'null/undefined' : `'${currentVariant}'`} `); console.log(`PostHog Redirects: Required variant: '${rule.variant}' (type: ${typeof rule.variant}) `); console.log(`PostHog Redirects: Current variant: '${currentVariant}' (type: ${typeof currentVariant}) `); console.log(`PostHog Redirects: Strict equality check: ${currentVariant} === ${rule.variant} = ${currentVariant === rule.variant} `); } // Check if the variant matches what we're targeting if (currentVariant === rule.variant) { // Preserve query parameters from current URL let redirectUrl = rule.to; const currentParams = window.location.search; if (currentParams) { redirectUrl += currentParams; if (isDebugMode) { console.log(`PostHog Redirects: Query parameters preserved: ${currentParams}`); } } if (isDebugMode) { console.log(`🚨 PostHog Redirects: REDIRECTING to ${redirectUrl} (${currentVariant} === ${rule.variant}) `); } if (isDebugMode) { console.log(`PostHog Redirects: ✅ Variant matches! Redirecting to ${redirectUrl}`); } window.location.href = redirectUrl; return; } else { if (isDebugMode) { console.log(`PostHog Redirects: ❌ Variant '${currentVariant}' does not match target '${rule.variant}' `); console.log(`PostHog Redirects: Flag '${rule.flag}' value from PostHog: ${currentVariant === null || currentVariant === undefined ? 'null/undefined' : `'${currentVariant}'`} `); console.log(`PostHog Redirects: Required variant: '${rule.variant}' (type: ${typeof rule.variant}) `); console.log(`PostHog Redirects: Current variant: '${currentVariant}' (type: ${typeof currentVariant}) `); console.log(`PostHog Redirects: Strict equality check: ${currentVariant} === ${rule.variant} = ${currentVariant === rule.variant} `); } } } if (isDebugMode) { console.log('PostHog Redirects: No matching variants found, staying on current page'); } }); } // Start checking for redirects checkRedirectRules(); })(); ``` -------------------------------- ### EnlighterJS Initialization Source: https://www.immy.bot/category/community-calls Initializes the EnlighterJS syntax highlighter with specific options for code blocks and inline code. This script enhances the display of code on web pages. ```javascript /* */ ``` -------------------------------- ### Initialize HubSpot Tracking Source: https://www.immy.bot/technicians Initializes HubSpot tracking for the page, setting the content type to 'standard-page'. ```javascript var _hsq = _hsq || []; _hsq.push(["setContentType", "standard-page"]); ``` -------------------------------- ### Blog Layout and Styling Source: https://www.immy.bot/technicians CSS rules for blog post layouts, including hiding elements before the loop, styling headings, adjusting content width, and customizing blockquotes. ```css /*------------ Blog ------------*/ .nectar_before_blog_loop_start{ display:none!important; } h3.post-heading{ font-size:28px!important; } body.single-post #ajax-content-wrap .container-wrap.no-sidebar .post-area, .single-post .featured-media-under-header__content{ max-width:1200px; } } blockquote { font-family: 'Outfit'; font-style:italic; font-weight: 800; line-height: 34px; font-size: 22px; letter-spacing: .5px; margin-bottom: 30px; } .wpb_text_column blockquote p{ color:#fff!important; } .material blockquote::before{ border-color:#01EAD1!important; } .wpb_video_wrapper iframe{ border-radius:20px; } .masonry.material .masonry-blog-item .article-content-wrap, .masonry.material .masonry-blog-item h3{ color:#fff; background-color:transparent; } .masonry.material .masonry-blog-item .article-content-wrap{ padding:30px 0 0 0!important; } .masonry-blog-item{ margin-bottom:20px; } .masonry-blog-item .content-inner .post-featured-img img{ border-radius:20px; } .blogsidebar .wpb_text_column{ border:3px solid #666; border-radius:15px; padding:5px 0 10px 15px; } .blogsidebar ol li a{ color:#fff; font-size:16px; font-weight:400; line-height:1.1!important; text-decoration:none; display:block; } .blogsidebar ol li{ margin-bottom:3px; } .blogsidebar ol li a:hover{ color:#bbb; text-decoration:underline; } @media only screen (min-width: 1000px){ .blogsidebar{ padding-left:0!important; } body.single-post #ajax-content-wrap .container-wrap.no-sidebar .post-area{ max-width:1200px; } } .customerstoryad{ padding:0!important; } .customerstorybio{ border-radius:50%!important; } .nectar-post-grid-filters h4:before, .nectar-post-grid-filters h4:after{ background-color:#fff!important; } .nectar-post-grid-filters a.active{ color:#fff; } .nectar-post-grid-filters a{ color:#ccc; } .nectar-post-grid-filters a::after { content: ''; position: absolute; width: 100%; transform: scaleX(0); height: 2px; bottom: 0; left: 0; background-color: #fff; transform-origin: bottom right; transition: transform 0.25s ease-out; } .nectar-post-grid-filters a:hover::after { transform: scaleX(1); transform-origin: bottom center; } /*------------ End Blog ------------*/ ``` -------------------------------- ### Initialize PostHog Data Layer Source: https://www.immy.bot/customer-testimonial/tre-eiler-automation-manager-courser This snippet initializes the PostHog data layer for analytics tracking. It's typically placed in the head of the HTML document. ```javascript tNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-WBTH9G5D'); var _hsq = _hsq || []; _hsq.push(["setContentType", "blog-post"]); var root = document.getElementsByTagName( "html" )[0]; root.setAttribute( "class", "js" ); ``` -------------------------------- ### PostHog Redirect Logic Source: https://www.immy.bot/technicians Implements A/B testing redirects using PostHog. It checks for existing cookies for instant redirects and logs debug information. This script is intended for return visits. ```javascript const rules = []; const isDebugMode = false; const debugRules = []; function attemptInstantRedirect() { for (const rule of rules) { const cookieName = `posthog_variant_${rule.flag}`; const cookieValue = document.cookie .split('; ') .find(row => row.startsWith(cookieName + '=')) ?.split('=')[1]; if (cookieValue === rule.variant) { if (isDebugMode) { console.log(`🚀 PostHog Redirects: INSTANT redirect using existing cookie - ${rule.flag}:${cookieValue}`); } let redirectUrl = rule.to; const currentParams = window.location.search; if (currentParams) { redirectUrl += currentParams; } window.location.href = redirectUrl; return true; } } return false; } if (rules.length > 0 && attemptInstantRedirect()) { return; } if (isDebugMode) { console.log('🚀 PostHog Redirects: Script loaded', { rulesCount: rules.length, debugMode: isDebugMode }); } if (isDebugMode) { console.log('🐞 PostHog Redirects Debug Started'); console.log('PostHog Redirects: Current URL:', window.location.href); console.log('PostHog Redirects: Browser pathname:', window.location.pathname); console.log('PostHog Redirects: Server detected path:', 'technicians'); console.log('PostHog Redirects: === PATH EXTRACTION ==='); console.log('PostHog Redirects: Raw REQUEST_URI from server:', '/technicians/'); console.log('PostHog Redirects: Path for matching:', 'technicians'); console.log('PostHog Redirects: Total redirect rules configured:', 1); console.log('PostHog Redirects: All rules (showing "from" paths):', debugRules.map(r => r.from)); console.log('PostHog Redirects: Matching rules for current path:', rules.length); if (rules.length > 0) { console.log('🎯 MATCH FOUND! Rules that match current path:', rules); console.log('PostHog Redirects: Will now check PostHog feature flags using recommended onFeatureFlags approach...'); } else { console.log('📍 PostHog Redirects: No rules match current path, no redirects will be attempted'); } } ``` -------------------------------- ### Masonry Blog Item Styling for Material Theme Source: https://www.immy.bot/documentation/administration Styles blog items in a masonry layout with a material theme. Sets text color and background for content within items. ```CSS .masonry.material .masonry-blog-item .article-content-wrap, .masonry.material .masonry-blog-item h3{ color:#fff; background-color:transparent; } ``` ```CSS .masonry.material .masonry-blog-item .article-content-wrap{ padding:30px 0 0 0 !important; } ``` -------------------------------- ### CSS for Masonry Blog Item Styling Source: https://www.immy.bot/community-calls/community-call-may-2026 Styles masonry blog items, setting text color to white and background to transparent. Also adjusts padding and image border-radius. ```css .masonry.material .masonry-blog-item .article-content-wrap, .masonry.material .masonry-blog-item h3{ color:#fff; background-color:transparent; } .masonry.material .masonry-blog-item .article-content-wrap{ padding:30px 0 0 0!important; } .masonry-blog-item{ margin-bottom:20px; } .masonry-blog-item .content-inner .post-featured-img img{ border-radius:20px; } ``` -------------------------------- ### WordPress Redirect Rule Troubleshooting Source: https://www.immy.bot/customer-testimonial/tre-eiler-automation-manager-courser Provides console log messages to help troubleshoot WordPress redirect rules. Ensure the 'From path' matches the URL and the rule is enabled. ```javascript function troubleshootRedirectRules() { if (isDebugMode) { console.log('PostHog Redirects: TROUBLESHOOTING:'); console.log(' 1. You have redirect rules configured in WordPress admin'); console.log(' 2. Verify the "From path" exactly matches the current URL path'); console.log(' 3. Ensure the redirect rule is enabled (toggle switch on)'); console.log(' 4. Remember paths are case-sensitive and should not include domain'); } return; } ``` -------------------------------- ### Cloudflare Challenge Platform Integration Source: https://www.immy.bot/documentation/gettingstarted Initializes a Cloudflare challenge platform script within an iframe. This is typically used for security checks. ```javascript (function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.\"__CF$cv$params={\"r\":\"a04f85d5efa464a7\",\"t\":\"MTc4MDMzMDU4Ng==\"}\"};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')\[0\]appendChild(a);";b.getElementsByTagName('head')\[0\]appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})() ```