Skip to content

Commit 1a5379f

Browse files
authored
Update Amplitude script (#2974)
[ ] Check if this is a typo or other quick fix and ignore the rest :) ## Type of change Fix Amplitude script - use SDK2 --------- Signed-off-by: s-stumbo <sally.stumbo@chainguard.dev>
1 parent 4cf7707 commit 1a5379f

File tree

1 file changed

+11
-32
lines changed

1 file changed

+11
-32
lines changed

layouts/partials/amplitude.html

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,16 @@
1-
<script>
2-
(function(e,t){var n=e.amplitude||{_q:[],_iq:{}};
3-
var r=t.createElement("script");r.type="text/javascript";
4-
r.integrity="sha384-RXg9t8S3YkP4zZ8Ytq5qzW8j5Rk1U0Z9k+0nZJ0q9z7GZx7q0Z0pZ1k5Y1Q";
5-
r.crossOrigin="anonymous";
6-
r.async=true;
7-
r.src="https://cdn.amplitude.com/libs/amplitude-8.18.1-min.gz.js";
8-
r.onload=function(){if(!e.amplitude.runQueuedFunctions){
9-
console.log("[Amplitude] Error: could not load SDK");}};
10-
var i=t.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i);
11-
function s(e,t){e.prototype[t]=function(){
12-
this._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
13-
return this;}}
14-
var o=function(){this._q=[];return this;};
15-
var a=["add","append","clearAll","prepend","set","setOnce","unset"];
16-
for(var c=0;c<a.length;c++){s(o,a[c]);}
17-
n.Identify=o;
18-
var u=function(){this._q=[];return this;};
19-
var l=["setProductId","setQuantity","setPrice","setRevenueType","setEventProperties"];
20-
for(var p=0;p<l.length;p++){s(u,l[p]);}
21-
n.Revenue=u;
22-
var d=["init","logEvent","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","enableTracking","setGlobalUserProperties"];
23-
for(var v=0;v<d.length;v++){s(n,d[v]);}
24-
e.amplitude=n;
25-
})(window,document);
1+
<script type="text/javascript">
2+
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},i=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};!function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})}(e,t,Array.prototype.slice.call(arguments))}},o=function(e){for(var t=0;t<m.length;t++)i(e,m[t],!1);for(var r=0;r<y.length;r++)i(e,y[r],!0)};r.invoked=!0;var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-w6jnsz1UVI8/tE15OISsDGEwBXn+DnL4t6sAQk2CimY5iBtLvv5Ct4i+Hm8mIPmJ",c.crossOrigin="anonymous",c.async=!0,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.34.0-min.js.gz",c.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(c,a);for(var u=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],l=0;l<p.length;l++)n(u,p[l]);r.Identify=u;for(var d=function(){return this._q=[],this},v=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setReceipt","setReceiptSig","setCurrency","setEventProperties"],f=0;f<v.length;f++)n(d,v[f]);r.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],y=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];o(r),r.createInstance=function(e){return r._iq[e]={_q:[]},o(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}();
263

27-
amplitude.init("riFvUF9GxrejDk1NxL6tLLSPJhJJmMW5", {
28-
defaultTracking: {
4+
amplitude.init("236e35f9a2d73bd6ef119c59d1f41ffb", {
5+
autocapture: {
6+
attribution: false,
297
pageViews: true,
30-
sessions: true
8+
sessions: true,
9+
formInteractions: false,
10+
fileDownloads: false,
11+
elementInteractions: false,
12+
pageUrlEnrichment: false,
13+
webVitals: false,
3114
}
3215
});
33-
amplitude.logEvent("docs_page_view", {
34-
path: window.location.pathname,
35-
title: document.title
36-
});
3716
</script>

0 commit comments

Comments
 (0)