Created
August 1, 2025 19:48
-
-
Save robisatthefunction/2e9916c528805fafbe37af9371c714e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| 'use strict'; | |
| console.log('π Zaius injection script starting...'); | |
| console.log('π Current URL:', window.location.href); | |
| console.log('π Document ready state:', document.readyState); | |
| // Function to inject the Zaius script | |
| function injectZaiusScript() { | |
| console.log('π§ Starting Zaius script injection process...'); | |
| // Check if Zaius is already loaded to avoid duplicates | |
| if (window.zaius) { | |
| console.warn('β οΈ Zaius script already exists on this page - skipping injection'); | |
| console.log('π Existing zaius object:', window.zaius); | |
| return; | |
| } | |
| console.log('β No existing Zaius found - proceeding with injection'); | |
| // Create the script element | |
| console.log('π Creating script element...'); | |
| var script = document.createElement('script'); | |
| script.type = 'text/javascript'; | |
| script.innerHTML = ` | |
| var zaius = window['zaius']||(window['zaius']=[]);zaius.methods=["initialize","onload","customer","entity","event","subscribe","unsubscribe","consent","identify","anonymize","dispatch"];zaius.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);zaius.push(t);return zaius}};(function(){for(var i=0;i<zaius.methods.length;i++){var method=zaius.methods[i];zaius[method]=zaius.factory(method)}var e=document.createElement("script");e.type="text/javascript";e.async=true;e.src=("https:"===document.location.protocol?"https://":"http://")+"d1igp3oop3iho5.cloudfront.net/v2/W4WzcEs-ABgXorzY7h1LCQ/zaius-min.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})(); | |
| // Edits to this script should only be made below this line. | |
| zaius.event('pageview'); | |
| `; | |
| console.log('π Script content prepared, length:', script.innerHTML.length, 'characters'); | |
| // Find injection target | |
| var target = document.head || document.getElementsByTagName('head')[0] || document.body; | |
| console.log('π― Injection target found:', target ? target.tagName : 'NONE'); | |
| if (target) { | |
| console.log('π Injecting script into', target.tagName, 'element...'); | |
| target.appendChild(script); | |
| console.log('π Zaius script successfully injected into PingIdentity page!'); | |
| // Verify injection | |
| setTimeout(function() { | |
| console.log('π Verifying injection - zaius object exists:', !!window.zaius); | |
| if (window.zaius) { | |
| console.log('β Zaius object confirmed:', window.zaius); | |
| } | |
| }, 100); | |
| } else { | |
| console.error('β Could not find head or body element to inject script'); | |
| console.log('ποΈ Document structure:', { | |
| head: !!document.head, | |
| body: !!document.body, | |
| documentElement: !!document.documentElement | |
| }); | |
| } | |
| } | |
| // Run injection immediately | |
| console.log('β‘ Running injection immediately...'); | |
| injectZaiusScript(); | |
| console.log('π Injection script completed'); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment