Socket
Socket
Sign inDemoInstall

soundcloud-iframe-analytics

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

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(n,e){return n.hasOwnProperty(e)||(n[e]={id:e,started:!1,paused:!1,finished:!1}),n[e]}function p(n,e){for(var t=0,o=n.length;t<o;++t)e(n[t])}window.onload=function(){var n=[];p(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&&p(n,function(n){!function(n){var e=SC.Widget.Events,t=!1,o="",i={},r=void 0;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=l(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=l(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=l(i,o)).paused||r.finished||c(s,"Playback scrubbed",o)}),n.bind(e.FINISH,function(){(r=l(i,o)).finished||(r.finished=!0,c(s,"Played in full",o))})}(SC.Widget(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=d.GlobalSiteTag:"function"==typeof window.ga?u=d.GA:"_gaq"in window&&"function"==typeof window._gaq.push&&(u=d.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,d={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])}}},f="https://w.soundcloud.com/player/api.js",s="soundcloud.com",l="SoundCloud";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])}a=[],g(document.getElementsByTagName("iframe"),function(n){n.hasAttribute("src")&&n.getAttribute("src").indexOf(s)>-1&&a.push(n)}),0!==a.length&&o.loadScript(f,function(){"SC"in window&&g(a,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(l,"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(l,"Playback started",o)):r.paused&&(r.paused=!1,c(l,"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(l,"Playback paused",o))})}),n.bind(e.SEEK,function(){(r=p(i,o)).paused||r.finished||c(l,"Playback scrubbed",o)}),n.bind(e.FINISH,function(){(r=p(i,o)).finished||(r.finished=!0,c(l,"Played in full",o))})}.bind(window,e))})})},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.1",
"version": "1.0.2",
"description": "Automated Google Analytics tracking of user interaction on embedded SoundCloud iframes",

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

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

A minimal library that attaches Google Analytics event tracking to user interactions
performed on embedded SoundCloud IFRAMEs.
performed on embedded SoundCloud iframes, both on single tracks as well as playlists.

@@ -12,2 +12,4 @@ This allows you to track user behaviour as well as have the events act as beacons to

See it in action [here](http://rawgit.com/igorski/soundcloud-iframe-analytics/master/dist/index.html).
## Installation

@@ -23,3 +25,3 @@

Embed the SoundCloud IFRAMEs according to the embed code provided by SoundCloud. You do not need to make
Embed the SoundCloud iframes according to the embed code provided by SoundCloud. You do not need to make
any changes to your markup. E.g. simply inject one or more instances of:

@@ -32,4 +34,4 @@

Include the minimized production version of the script (_./dist/sia.min.js_) and the script
will automatically attach event listeners once the page has finished loading.
Include the minimized production version of the script (_./dist/sia.min.js_) at the bottom of your page
and the script will automatically attach event listeners to the iframes.

@@ -36,0 +38,0 @@ Alternatively, you can import the ES6 module from the _./src_ folder and embed the library

import { init } from './soundcloud/SoundCloud.js';
// application bootstraps when the document has finished loading, voila.
window.onload = init;
init();

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

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

@@ -60,2 +60,10 @@ }

widget.bind( ENUM.READY, () => {
// no need to track, can be used for debugging purposes
});
widget.bind( ENUM.ERROR, () => {
trackEvent( ANALYTICS_EVENT_CATEGORY, "Error", currentId );
});
widget.bind( ENUM.PLAY_PROGRESS, () => {

@@ -62,0 +70,0 @@

Sorry, the diff of this file is not supported yet

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