Socket
Socket
Sign inDemoInstall

soundcloud-iframe-analytics

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.5 to 1.0.6

src/third_party/analytics.js

2

dist/sia.min.js

@@ -1,2 +0,2 @@

!function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=1)}([function(e,n,t){n.loadScript=t(3),n.loadScriptPromised=t(2)},function(e,n,t){"use strict";t.r(n);var o=t(0),r=!1,i=!0,u=void 0;function c(e,n,t,o){if(i){var c=function(){if(u)return u;"function"==typeof window.gtag?u=s.GlobalSiteTag:"function"==typeof window.ga?u=s.GA:"_gaq"in window&&"function"==typeof window._gaq.push&&(u=s.Legacy);return u||(i=!1,null)}();c&&(r&&console.info('Tracking Event: category "'+e+'" action "'+n+'" label "'+t+'" value "'+o+'"'),c.event(e,n,t,o))}}var s={GlobalSiteTag:{event:function(e,n,t,o){window.gtag("event",n,{event_category:e,event_label:t,value:o})}},GA:{event:function(e,n,t,o){window.ga("send","event",e,n,t)}},Legacy:{event:function(e,n,t,o){window._gaq.push(["_trackEvent",e,n,t])}}},d="https://w.soundcloud.com/player/api.js",a="soundcloud.com",f="SoundCloud";function p(){var e=[];if(g(document.getElementsByTagName("iframe"),function(n){n.hasAttribute("src")&&n.getAttribute("src").indexOf(a)>-1&&e.push(n)}),0!==e.length){var n=function(){g(e,function(e){!function(e){var n=SC.Widget.Events,t=!1,o="",r=0,i={},u=void 0;e.bind(n.READY,function(){}),e.bind(n.ERROR,function(){c(f,"Error",o)}),e.bind(n.PLAY_PROGRESS,function(n){u&&u.id===n.soundId&&function(e,n){if("number"!=typeof n.relativePosition)return;e.progress=Math.round(100*n.relativePosition);var t=void 0;e.progress>=99&&e.progstep<4?(t="4/4",e.progstep=4):e.progress>=75&&e.progstep<3?(t="3/4",e.progstep=3):e.progress>=50&&e.progstep<2?(t="2/4",e.progstep=2):e.progress>=25&&e.progstep<1&&(t="1/4",e.progstep=1);"string"==typeof t&&(e.scrubbed&&(t+=" with scrubbing"),c(f,"Progress "+t,e.title))}(u,n),t||(t=!0,setTimeout(function(){t=!1,e.getCurrentSound(function(e){r!==e.id&&(o=e.title,r=e.id,i={})})},0===r?0:2500))}),e.bind(n.PLAY,function(){e.getCurrentSound(function(e){o=e.title,r=e.id,!(u=l(i,e.title,e.id)).started||u.finished?(u.started=!0,u.finished=!1,u.paused=!1,u.scrubbed=!1,u.progress=0,u.progstep=0,c(f,"Playback started",o)):u.paused&&(u.paused=!1,c(f,"Playback resumed",o))})}),e.bind(n.PAUSE,function(){u=l(i,o,r),e.getCurrentSound(function(e){e.id!==u.id||u.finished||(u.paused=!0,c(f,"Playback paused",o))})}),e.bind(n.SEEK,function(){(u=l(i,o,r)).scrubbed||u.paused||u.finished||(u.scrubbed=!0,c(f,"Playback scrubbed",o))}),e.bind(n.FINISH,function(){if(!(u=l(i,o,r)).finished){u.finished=!0;var e=u.scrubbed?"Played in full with scrubbing":"Played in full";c(f,e,o)}})}(SC.Widget(e))})};"SC"in window&&"function"==typeof SC.Widget?n():o.loadScript(d,n)}}function l(e,n,t){return e.hasOwnProperty(n)?0===e[n].id&&(e[n].id=t):e[n]={title:n,id:t,started:!1,paused:!1,scrubbed:!1,finished:!1,progress:0,progstep:0},e[n]}function g(e,n){for(var t=0,o=e.length;t<o;++t)n(e[t])}document.addEventListener("DOMContentLoaded",function e(){p(),document.removeEventListener("DOMContentLoaded",e)})},function(e,n){e.exports=function(e,n){var t,o,r=document;return new Promise(function(i,u){o=r.createElement("script"),t=r.getElementsByTagName("script")[0],n&&Object.keys(n).forEach(function(e){o[e]=n[e]}),o.async=1,o.src=e,o.onload=function(){i()},o.onerror=function(){u(new Error("failed to load: "+e))},t.parentNode.insertBefore(o,t)})}},function(e,n){e.exports=function(e,n,t){var o,r,i=document;r=i.createElement("script"),o=i.getElementsByTagName("script")[0],t&&Object.keys(t).forEach(function(e){r[e]=t[e]}),r.async=1,r.src=e,r.onload=function(){n()},r.onerror=function(){n(new Error("failed to load: "+e))},o.parentNode.insertBefore(r,o)}}]);
!function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(o,r,function(n){return e[n]}.bind(null,r));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=3)}([function(e,n,t){n.loadScript=t(1),n.loadScriptPromised=t(2)},function(e,n){e.exports=function(e,n,t){var o,r,i=document;r=i.createElement("script"),o=i.getElementsByTagName("script")[0],t&&Object.keys(t).forEach((function(e){r[e]=t[e]})),r.async=1,r.src=e,r.onload=function(){n()},r.onerror=function(){n(new Error("failed to load: "+e))},o.parentNode.insertBefore(r,o)}},function(e,n){e.exports=function(e,n){var t,o,r=document;return new Promise((function(i,u){o=r.createElement("script"),t=r.getElementsByTagName("script")[0],n&&Object.keys(n).forEach((function(e){o[e]=n[e]})),o.async=1,o.src=e,o.onload=function(){i()},o.onerror=function(){u(new Error("failed to load: "+e))},t.parentNode.insertBefore(o,t)}))}},function(e,n,t){"use strict";t.r(n);var o,r=t(0),i=t.n(r),u=!0;function d(e,n,t,r){if(u){var i=function(){if(o)return o;"function"==typeof window.gtag?o=c.GlobalSiteTag:"function"==typeof window.ga?o=c.GA:"_gaq"in window&&"function"==typeof window._gaq.push&&(o=c.Legacy);return o||(u=!1,null)}();i&&i.event(e,n,t,r)}}var c={GlobalSiteTag:{event:function(e,n,t,o){window.gtag("event",n,{event_category:e,event_label:t,value:o})}},GA:{event:function(e,n,t,o){window.ga("send","event",e,n,t)}},Legacy:{event:function(e,n,t,o){window._gaq.push(["_trackEvent",e,n,t])}}};function s(){var e=document.getElementsByTagName("iframe"),n=[];if(f(e,(function(e){e.hasAttribute("src")&&e.getAttribute("src").indexOf("soundcloud.com")>-1&&n.push(e)})),0!==n.length){var t=function(){f(n,(function(e){!function(e){var n,t=SC.Widget.Events,o=!1,r="",i=0,u={};e.bind(t.READY,(function(){})),e.bind(t.ERROR,(function(){d("SoundCloud","Error",r)})),e.bind(t.PLAY_PROGRESS,(function(t){n&&n.id===t.soundId&&function(e,n){if("number"!=typeof n.relativePosition)return;var t;e.progress=function(e){return Math.round(100*e.relativePosition)}(n),e.progress>=99&&e.progstep<4?(t="4/4",e.progstep=4):e.progress>=75&&e.progstep<3?(t="3/4",e.progstep=3):e.progress>=50&&e.progstep<2?(t="2/4",e.progstep=2):e.progress>=25&&e.progstep<1&&(t="1/4",e.progstep=1);"string"==typeof t&&(e.scrubbed&&(t+=" with scrubbing"),d("SoundCloud","Progress ".concat(t),e.title))}(n,t),o||(o=!0,setTimeout((function(){o=!1,e.getCurrentSound((function(e){i!==e.id&&(r=e.title,i=e.id,u={})}))}),0===i?0:2500))})),e.bind(t.PLAY,(function(){e.getCurrentSound((function(e){r=e.title,i=e.id,!(n=a(u,e.title,e.id)).started||n.finished?(n.started=!0,n.finished=!1,n.paused=!1,n.scrubbed=!1,n.progress=0,n.progstep=0,d("SoundCloud","Playback started",r)):n.paused&&(n.paused=!1,d("SoundCloud","Playback resumed",r))}))})),e.bind(t.PAUSE,(function(){n=a(u,r,i),e.getCurrentSound((function(e){e.id!==n.id||n.finished||(n.paused=!0,d("SoundCloud","Playback paused",r))}))})),e.bind(t.SEEK,(function(e){(n=a(u,r,i)).scrubbed||n.paused||n.finished||(n.scrubbed=!0,d("SoundCloud","Playback scrubbed",r))})),e.bind(t.FINISH,(function(){(n=a(u,r,i)).finished||(n.finished=!0,d("SoundCloud",n.scrubbed?"Played in full with scrubbing":"Played in full",r))}))}(SC.Widget(e))}))};"SC"in window&&"function"==typeof SC.Widget?t():i.a.loadScript("https://w.soundcloud.com/player/api.js",t)}}function a(e,n,t){return e.hasOwnProperty(n)?0===e[n].id&&(e[n].id=t):e[n]={title:n,id:t,started:!1,paused:!1,scrubbed:!1,finished:!1,progress:0,progstep:0},e[n]}function f(e,n){for(var t=0,o=e.length;t<o;++t)n(e[t])}document.addEventListener("DOMContentLoaded",(function e(){s(),document.removeEventListener("DOMContentLoaded",e)}))}]);
//# sourceMappingURL=sia.min.js.map
{
"name": "soundcloud-iframe-analytics",
"version": "1.0.5",
"version": "1.0.6",
"description": "Automated Google Analytics tracking of user interaction on embedded SoundCloud iframes",

@@ -19,25 +19,28 @@ "author": "Igor Zinken",

"devDependencies": {
"ejs-compiled-loader": "1.1.0",
"babel-core": "6.26.0",
"babel-loader": "7.1.4",
"babel-preset-env": "1.6.1",
"@babel/core": "7.9.6",
"@babel/plugin-transform-runtime": "^7.9.6",
"@babel/preset-env": "7.9.6",
"babel-loader": "8.1.0",
"chai": "^1.9.2",
"clean-webpack-plugin": "0.1.19",
"cross-env": "5.1.4",
"css-loader": "0.28.11",
"css-loader": "^3.5.3",
"ejs-compiled-loader": "^2.2.0",
"file-loader": "1.1.11",
"html-webpack-plugin": "3.2.0",
"mocha": "^2.2.5",
"mocha-loader": "^1.1.3",
"node-sass": "4.8.3",
"mocha": "^7.1.2",
"mocha-loader": "^5.0.0",
"node-sass": "^4.14.0",
"sass-loader": "7.0.1",
"sinon": "^2.3.4",
"style-loader": "0.21.0",
"tiny-script-loader": "^2.1.0",
"url-loader": "1.0.1",
"webpack": "4.6.0",
"webpack-cli": "2.0.14",
"webpack-dev-server": "3.1.3",
"webpack": "4.43.0",
"webpack-cli": "3.3.11",
"webpack-dev-server": ">=3.1.11",
"webpack-merge": "4.1.2"
},
"dependencies": {
"tiny-script-loader": "^2.2.1"
}
}

@@ -54,3 +54,3 @@ SoundCloud IFRAME Analytics

```JavaScript
import { attachSoundCloudAnalytics } from "soundcloud-iframe-analytics/soundcloud/SoundCloud.js";
import { attachSoundCloudAnalytics } from "soundcloud-iframe-analytics/src/soundcloud/SoundCloud";

@@ -57,0 +57,0 @@ const existingWidget = ...; // SC.Widget instance created elsewhere in your application

@@ -1,2 +0,2 @@

import { init } from './soundcloud/SoundCloud.js';
import { init } from './third_party/soundcloud';

@@ -3,0 +3,0 @@ // initialize the code as soon as the HTML Document is ready

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc