/** * @license Angulartics * (c) 2014 Carl Thorner http://luisfarzati.github.io/angulartics * Contributed by http://github.com/L42y * License: MIT */ !function(a){"use strict";/** * @ngdoc overview * @name angulartics.marketo * Enables analytics support for Marketo (http://www.marketo.com) * * Will not be considered loaded until the sKey attribute is set on the Munchkin object, like so: * * Munchkin.skey = 'my-secret-key'; * * for event tracking email is a required attribute */ a.module("angulartics.marketo",["angulartics"]).config(["$analyticsProvider",function(a){angulartics.waitForVendorApi("Munchkin",500,"sKey",function(b){a.registerPageTrack(function(a){b.munchkinFunction("visitWebPage",{url:a})})}), // If a path is set as a property we do a page tracking event. angulartics.waitForVendorApi("Munchkin",500,"sKey",function(b){a.registerEventTrack(function(a,c){if(void 0!==c.path){var d=[];for(var e in c)"path"!==e&&d.push(e+"="+c[e]);"CLICK"==a.toUpperCase()&&b.munchkinFunction("clickLink",{href:c.path}),b.munchkinFunction("visitWebPage",{url:c.path,params:d.join("&")})}})});var b=function(a){void 0!==a.email&&(email=a.email,email_sha=sha1(Munchkin.sKey+email),a.Email=a.email,Munchkin.munchkinFunction("associateLead",a,email_sha))};angulartics.waitForVendorApi("Munchkin",500,function(c){a.registerSetUsername(function(a){/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/.test(a)&&b({Email:a})})}),angulartics.waitForVendorApi("Munchkin",500,function(c){a.registerSetUserProperties(function(a){b(a)})}),angulartics.waitForVendorApi("Munchkin",500,function(c){a.registerSetUserPropertiesOnce(function(a){b(a)})})}])}(angular);