|
| 1 | +<!doctype html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <meta charset="UTF-8" /> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 6 | + <meta name="description" content="Partytown Test Page - FullStory via GTM" /> |
| 7 | + |
| 8 | + <title>Partytown FullStory via GTM</title> |
| 9 | + |
| 10 | + <script> |
| 11 | + partytown = { |
| 12 | + forward: ['FS.identify', 'FS.event'], |
| 13 | + strictProxyHas: true, |
| 14 | + }; |
| 15 | + </script> |
| 16 | + <script src="/~partytown/debug/partytown.js"></script> |
| 17 | + |
| 18 | + <!-- Exact FullStory snippet from GTM Custom HTML tag --> |
| 19 | + <script type="text/partytown"> |
| 20 | + window['_fs_host'] = 'fullstory.example.com'; |
| 21 | + window['_fs_script'] = 'fullstory.example.com/s/fs.js'; |
| 22 | + window['_fs_app_host'] = 'app.fullstory.com'; |
| 23 | + window['_fs_org'] = 'o-ABC123-na1'; |
| 24 | + window['_fs_namespace'] = 'FS'; |
| 25 | + !function(m,n,e,t,l,o,g,y){var s,f,a=function(h){ |
| 26 | + return!(h in m)||(m.console&&m.console.log&&m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'),!1)}(e) |
| 27 | + ;function p(b){var h,d=[];function j(){h&&(d.forEach((function(b){var d;try{d=b[h[0]]&&b[h[0]](h[1])}catch(h){return void(b[3]&&b[3](h))} |
| 28 | + d&&d.then?d.then(b[2],b[3]):b[2]&&b[2](d)})),d.length=0)}function r(b){return function(d){h||(h=[b,d],j())}}return b(r(0),r(1)),{ |
| 29 | + then:function(b,h){return p((function(r,i){d.push([b,h,r,i]),j()}))}}}a&&(g=m[e]=function(){var b=function(b,d,j,r){function i(i,c){ |
| 30 | + h(b,d,j,i,c,r)}r=r||2;var c,u=/Async$/;return u.test(b)?(b=b.replace(u,""),"function"==typeof Promise?new Promise(i):p(i)):h(b,d,j,c,c,r)} |
| 31 | + ;function h(h,d,j,r,i,c){return b._api?b._api(h,d,j,r,i,c):(b.q&&b.q.push([h,d,j,r,i,c]),null)}return b.q=[],b}(),y=function(b){function h(h){ |
| 32 | + "function"==typeof h[4]&&h[4](new Error(b))}var d=g.q;if(d){for(var j=0;j<d.length;j++)h(d[j]);d.length=0,d.push=h}},function(){ |
| 33 | + (o=n.createElement(t)).async=!0,o.crossOrigin="anonymous",o.src="https://"+l,o.onerror=function(){y("Error loading "+l)} |
| 34 | + ;var b=n.getElementsByTagName(t)[0];b&&b.parentNode?b.parentNode.insertBefore(o,b):n.head.appendChild(o)}(),function(){function b(){} |
| 35 | + function h(b,h,d){g(b,h,d,1)}function d(b,d,j){h("setProperties",{type:b,properties:d},j)}function j(b,h){d("user",b,h)}function r(b,h,d){j({ |
| 36 | + uid:b},d),h&&j(h,d)}g.identify=r,g.setUserVars=j,g.identifyAccount=b,g.clearUserCookie=b,g.setVars=d,g.event=function(b,d,j){h("trackEvent",{ |
| 37 | + name:b,properties:d},j)},g.anonymize=function(){r(!1)},g.shutdown=function(){h("shutdown")},g.restart=function(){h("restart")}, |
| 38 | + g.log=function(b,d){h("log",{level:b,msg:d})},g.consent=function(b){h("setIdentity",{consent:!arguments.length||b})}}(),s="fetch", |
| 39 | + f="XMLHttpRequest",g._w={},g._w[f]=m[f],g._w[s]=m[s],m[s]&&(m[s]=function(){return g._w[s].apply(this,arguments)}),g._v="2.0.0") |
| 40 | + }(window,document,window._fs_namespace,"script",window._fs_script); |
| 41 | + </script> |
| 42 | + |
| 43 | + <link |
| 44 | + rel="icon" |
| 45 | + id="favicon" |
| 46 | + href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🌎</text></svg>" |
| 47 | + /> |
| 48 | + <style> |
| 49 | + body { |
| 50 | + font-family: |
| 51 | + -apple-system, |
| 52 | + BlinkMacSystemFont, |
| 53 | + Segoe UI, |
| 54 | + Helvetica, |
| 55 | + Arial, |
| 56 | + sans-serif, |
| 57 | + Apple Color Emoji, |
| 58 | + Segoe UI Emoji; |
| 59 | + font-size: 12px; |
| 60 | + } |
| 61 | + h1 { |
| 62 | + margin: 0 0 15px 0; |
| 63 | + } |
| 64 | + button { |
| 65 | + padding: 10px 20px; |
| 66 | + margin: 10px 0; |
| 67 | + font-size: 14px; |
| 68 | + } |
| 69 | + p { |
| 70 | + margin: 10px 0; |
| 71 | + } |
| 72 | + strong { |
| 73 | + font-weight: 600; |
| 74 | + } |
| 75 | + </style> |
| 76 | + </head> |
| 77 | + <body> |
| 78 | + <h1>Partytown FullStory via GTM</h1> |
| 79 | + |
| 80 | + <p> |
| 81 | + <strong>FS exists:</strong> |
| 82 | + <span id="testFSExists"></span> |
| 83 | + </p> |
| 84 | + |
| 85 | + <p> |
| 86 | + <strong>FS.identify Test:</strong> |
| 87 | + <span id="testIdentify"></span> |
| 88 | + </p> |
| 89 | + |
| 90 | + <p> |
| 91 | + <strong>FS.event Test:</strong> |
| 92 | + <span id="testEvent"></span> |
| 93 | + </p> |
| 94 | + |
| 95 | + <script> |
| 96 | + function sendIdentify() { |
| 97 | + console.log('Calling FS.identify...'); |
| 98 | + window['FS'].identify('test-user-123', { |
| 99 | + displayName: 'Test User', |
| 100 | + email: 'test.user@example.com', |
| 101 | + }); |
| 102 | + document.getElementById('testIdentify').textContent = 'called'; |
| 103 | + } |
| 104 | + |
| 105 | + function sendEvent() { |
| 106 | + console.log('Calling FS.event...'); |
| 107 | + window['FS'].event('test_event', { |
| 108 | + property1: 'value1', |
| 109 | + property2: 'value2', |
| 110 | + }); |
| 111 | + document.getElementById('testEvent').textContent = 'called'; |
| 112 | + } |
| 113 | + </script> |
| 114 | + |
| 115 | + <button onclick="sendIdentify()" id="buttonSendIdentify">Test FS.identify</button> |
| 116 | + <button onclick="sendEvent()" id="buttonSendEvent">Test FS.event</button> |
| 117 | + |
| 118 | + <script type="text/partytown"> |
| 119 | + (function () { |
| 120 | + // Wait a bit for FullStory to initialize |
| 121 | + setTimeout(function() { |
| 122 | + if (typeof window['FS'] !== 'undefined' && typeof window['FS'].identify === 'function') { |
| 123 | + document.getElementById('testFSExists').textContent = 'yes'; |
| 124 | + } else { |
| 125 | + document.getElementById('testFSExists').textContent = 'no'; |
| 126 | + } |
| 127 | + document.body.classList.add('completed'); |
| 128 | + }, 100); |
| 129 | + })(); |
| 130 | + </script> |
| 131 | + |
| 132 | + <p><a href="/tests/integrations/full-story/">Back to FullStory Tests</a></p> |
| 133 | + <p><a href="/tests/">All Tests</a></p> |
| 134 | + </body> |
| 135 | +</html> |
0 commit comments