@rebilly/lead-source-tracker 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/build.js +1 -1
- package/package.json +2 -2
package/dist/build.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).RebillyLeadSource=t()}(this,(function(){"use strict";var e=function(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}((function(e,t){var n;n=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function c(t,n,c){if("undefined"!=typeof document){"number"==typeof(c=e({path:"/"},o.defaults,c)).expires&&(c.expires=new Date(1*new Date+864e5*c.expires)),c.expires=c.expires?c.expires.toUTCString():"";try{var i=JSON.stringify(n);/^[\{\[]/.test(i)&&(n=i)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var u="";for(var a in c)c[a]&&(u+="; "+a,!0!==c[a]&&(u+="="+c[a].split(";")[0]));return document.cookie=t+"="+n+u}}function i(e,n){if("undefined"!=typeof document){for(var o={},c=document.cookie?document.cookie.split("; "):[],i=0;i<c.length;i++){var u=c[i].split("="),a=u.slice(1).join("=");n||'"'!==a.charAt(0)||(a=a.slice(1,-1));try{var s=t(u[0]);if(a=(r.read||r)(a,s)||t(a),n)try{a=JSON.parse(a)}catch(e){}if(o[s]=a,e===s)break}catch(e){}}return e?o[e]:o}}return o.set=c,o.get=function(e){return i(e,!1)},o.getJSON=function(e){return i(e,!0)},o.remove=function(t,n){c(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}((function(){}))},e.exports=n()}));const t={expires:45},n=["path","referrer"],r=[...n,"source","medium","campaign","term","content","affiliate","subAffiliate","clickId","salesAgent"];function o(e,r){const{document:o}=e;if(function(e){const t=new URLSearchParams(e.location.search).has("dnt"),{dnt:n}=i(),r=function(e){const{navigator:t}=e;if(e.doNotTrack||t.doNotTrack||t.msDoNotTrack)return"1"==e.doNotTrack||"yes"==t.doNotTrack||"1"==t.doNotTrack||"1"==t.msDoNotTrack}(e);return t||r||n}(e))return c({dnt:!0}),{};const l={path:o.location.host+o.location.pathname,...a(o),...d(o),...s(e)},{leadSource:p}=function(e,r){const o=i();if(o.dnt||e.dnt)return c({dnt:!0});c({dnt:!1});const a=o.leadSource||{},s=n.reduce((e,t)=>{const n=a[t];return n&&(e[t]=n),e},{}),d={leadSource:{...a,...f(e.leadSource),...s}};return Object.assign(t,r||{}),u(d),d}({leadSource:l},r);return p||{}}function c({dnt:n=!1}){const r={dnt:n};return n?u(r):e.remove("rls",t),r}function i(){const t=e.getJSON("rls")||{};return t.dnt?{dnt:!0}:t}function u(n){e.set("rls",n,t)}function a(e){const{dataset:t}=e.querySelector("#rls-token")||{};return f(t)}function s(e){const t=new URLSearchParams(e.location.search);return f(r.reduce((e,n)=>(e[n]=t.get("utm_"+n)||t.get(n)||t.get("utm_"+n.toLowerCase())||t.get(n.toLowerCase())||null,e),{}))}function d(e){try{return new URL(e.referrer).hostname!==e.location.hostname?{referrer:e.referrer}:{}}catch(e){return{}}}function f(e={}){return r.reduce((t,n)=>{const r=(e[n]||"").trim();return r&&(t[n]=r),t},{})}return"undefined"!=typeof window&&document.addEventListener("DOMContentLoaded",()=>{o(window)}),{collect:o,clear:c}}));
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).RebillyLeadSource=t()}(this,(function(){"use strict";var e=function(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}((function(e,t){var n;n=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function c(t,n,c){if("undefined"!=typeof document){"number"==typeof(c=e({path:"/"},o.defaults,c)).expires&&(c.expires=new Date(1*new Date+864e5*c.expires)),c.expires=c.expires?c.expires.toUTCString():"";try{var i=JSON.stringify(n);/^[\{\[]/.test(i)&&(n=i)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var u="";for(var a in c)c[a]&&(u+="; "+a,!0!==c[a]&&(u+="="+c[a].split(";")[0]));return document.cookie=t+"="+n+u}}function i(e,n){if("undefined"!=typeof document){for(var o={},c=document.cookie?document.cookie.split("; "):[],i=0;i<c.length;i++){var u=c[i].split("="),a=u.slice(1).join("=");n||'"'!==a.charAt(0)||(a=a.slice(1,-1));try{var s=t(u[0]);if(a=(r.read||r)(a,s)||t(a),n)try{a=JSON.parse(a)}catch(e){}if(o[s]=a,e===s)break}catch(e){}}return e?o[e]:o}}return o.set=c,o.get=function(e){return i(e,!1)},o.getJSON=function(e){return i(e,!0)},o.remove=function(t,n){c(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}((function(){}))},e.exports=n()}));const t={expires:45},n=["path","referrer"],r=[...n,"source","medium","campaign","term","content","affiliate","subAffiliate","clickId","salesAgent"];function o(e,r){const{document:o}=e;if(function(e){const t=new URLSearchParams(e.location.search).has("dnt"),{dnt:n}=i(),r=function(e){const{navigator:t}=e;if(e.doNotTrack||t.doNotTrack||t.msDoNotTrack)return"1"==e.doNotTrack||"yes"==t.doNotTrack||"1"==t.doNotTrack||"1"==t.msDoNotTrack}(e);return t||r||n}(e))return c({dnt:!0}),{};const l={path:o.location.host+o.location.pathname,...a(o),...d(o),...s(e)},{leadSource:p}=function(e,r){const o=i();if(o.dnt||e.dnt)return c({dnt:!0});c({dnt:!1});const a=o.leadSource||{},s=n.reduce((e,t)=>{const n=a[t];return n&&(e[t]=n),e},{}),d={leadSource:{...a,...f(e.leadSource),...s}};return Object.assign(t,r||{}),u(d),d}({leadSource:l},r);return p||{}}function c({dnt:n=!1}){const r={dnt:n};return n?u(r):e.remove("rls",t),r}function i(){const t=e.getJSON("rls")||{};return t.dnt?{dnt:!0}:t}function u(n){e.set("rls",n,t)}function a(e){const{dataset:t}=e.querySelector("#rls-token")||{};return f(t)}function s(e){const t=new URLSearchParams(e.location.search);return f(r.reduce((e,n)=>(e[n]=t.get("utm_"+n)||t.get(n)||t.get("utm_"+n.toLowerCase())||t.get(n.toLowerCase())||null,e),{}))}function d(e){try{return new URL(e.referrer).hostname!==e.location.hostname?{referrer:e.referrer}:{}}catch(e){return{}}}function f(e={}){return r.reduce((t,n)=>{const r=(e[n]||"").trim();return r&&(t[n]=r),t},{})}return"undefined"!=typeof window&&document.addEventListener("DOMContentLoaded",()=>{o(window)}),{collect:o,clear:c}}));
|
package/package.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rebilly/lead-source-tracker",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.4.0",
|
4
4
|
"description": "Simple library which is used to collect and store lead source information into a cookie",
|
5
5
|
"author": "Rebilly",
|
6
|
-
"repository": "https://github.com/Rebilly/
|
6
|
+
"repository": "https://github.com/Rebilly/rebilly",
|
7
7
|
"main": "dist/build.js",
|
8
8
|
"files": [
|
9
9
|
"dist"
|