Socket
Socket
Sign inDemoInstall

soundcloud-iframe-analytics

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

soundcloud-iframe-analytics - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

dist/sia.min.js

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

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

@@ -5,0 +5,0 @@ "author": "Igor Zinken",

@@ -62,2 +62,23 @@ SoundCloud IFRAME Analytics

## Event message format
The message format for the tracked events is:
* **Category:** SoundCloud
* **Action:** See list below
* **Label:** Title of the SoundCloud track
The tracked actions are:
* _Playback started_
* _Playback paused_
* _Playback resumed_
* _Playback scrubbed_
* _Played in full_
* _Played in full with scrubbing_
Where starts are counted only once per track (unless it has finished playback).
Scrubbed indicates that the user has dragged the playback to a different point in the track and thus
might have skipped sections.
## Development

@@ -64,0 +85,0 @@

@@ -36,3 +36,3 @@ import * as TinyScriptLoader from "tiny-script-loader";

const widget = SC.Widget( playlist );
window.requestAnimationFrame( attachSoundCloudAnalytics.bind( window, widget ));
attachSoundCloudAnalytics( widget );
});

@@ -110,2 +110,3 @@ }

vo.paused = false;
vo.scrubbed = false;
trackEvent( ANALYTICS_EVENT_CATEGORY, "Playback started", currentId );

@@ -142,2 +143,3 @@ }

if ( !vo.paused && !vo.finished ) {
vo.scrubbed = true;
trackEvent( ANALYTICS_EVENT_CATEGORY, "Playback scrubbed", currentId );

@@ -150,3 +152,4 @@ }

vo.finished = true;
trackEvent( ANALYTICS_EVENT_CATEGORY, "Played in full", currentId );
const event = ( !vo.scrubbed ) ? "Played in full" : "Played in full with scrubbing";
trackEvent( ANALYTICS_EVENT_CATEGORY, event, currentId );
}

@@ -176,2 +179,3 @@ });

paused: false,
scrubbed: false,
finished: false

@@ -178,0 +182,0 @@ };

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc