@mparticle/web-sdk 3.2.3 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/mparticle.common.js +8 -3
- package/dist/mparticle.esm.js +8 -3
- package/dist/mparticle.js +11 -3
- package/package.json +4 -3
- package/src/pageViewTracker.ts +25 -1
package/README.md
CHANGED
|
@@ -10,6 +10,10 @@ Hello! This is the public repo of the mParticle Web SDK. We've built the mPartic
|
|
|
10
10
|
|
|
11
11
|
Fully detailed documentation and other information about mParticle web SDK can be found at our doc site [here](https://docs.mparticle.com/developers/sdk/web/initialization/)
|
|
12
12
|
|
|
13
|
+
## Web SDK v3
|
|
14
|
+
|
|
15
|
+
Version 3 of the mParticle Web SDK is generally available. See [MIGRATING.md](MIGRATING.md) for the in-repo upgrade steps, the [3.0.0 changelog](https://github.com/mParticle/mparticle-web-sdk/blob/main/CHANGELOG.md#300) for the full commit list, and the [Upgrade to Version 3](https://docs.mparticle.com/developers/client-sdks/web/upgrade-to-version-3/) guide on the docs site.
|
|
16
|
+
|
|
13
17
|
## Include and Initialize the SDK
|
|
14
18
|
|
|
15
19
|
There are two ways to initialize the SDK, either via a script tag, or you can bundle the SDK via NPM. A summary of steps for both are available below, but you should review the detailed documentation for the [script tag](https://docs.mparticle.com/developers/sdk/web/getting-started) and [self hosting](https://docs.mparticle.com/developers/sdk/web/self-hosting) on the mParticle docs site.
|
|
@@ -46,7 +50,7 @@ window.mParticle = {
|
|
|
46
50
|
};
|
|
47
51
|
|
|
48
52
|
//load the SDK
|
|
49
|
-
(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=
|
|
53
|
+
(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=3;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode"];var n=["identify","login","logout","modify","search"];var o=["selectPlacements","hashAttributes","hashSha256","setExtensionData","use","getVersion","terminate","onShoppableAdsReady"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var a,c,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,d="?env="+l,w=window.mParticle.config.dataPlan;if(w){a=w.planId;c=w.planVersion;if(a){if(c&&(c<1||c>1e3)){c=null}d+="&plan_id="+a+(c?"&plan_version="+c:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v3/"+e+"/mparticle.js"+d+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY");
|
|
50
54
|
```
|
|
51
55
|
|
|
52
56
|
You can then log events, for example, as follows:
|
package/dist/mparticle.common.js
CHANGED
|
@@ -15,7 +15,7 @@ map:function map(a,b){var c,d,e;if(null===this)throw new TypeError(" this is nul
|
|
|
15
15
|
filter:function filter(a/*, thisArg*/){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=2<=arguments.length?arguments[1]:void 0,f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g);}return d},// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
|
|
16
16
|
isArray:function isArray(a){return "[object Array]"===Object.prototype.toString.call(a)},Base64:Base64$1};
|
|
17
17
|
|
|
18
|
-
var version = "3.
|
|
18
|
+
var version = "3.3.1";
|
|
19
19
|
|
|
20
20
|
var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodHasBeenDeprecated:"has been deprecated.",MethodMarkedForDeprecationPostfix:"is a deprecated method and will be removed in future releases.",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally
|
|
21
21
|
},DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},// These are the paths that are used to construct the CNAME urls
|
|
@@ -826,8 +826,13 @@ var WIN_APV_KEY="__mpApv__";// The query params an auto page view may carry. An
|
|
|
826
826
|
var ALLOWED_QUERY_PARAMS=[// Campaign attribution
|
|
827
827
|
"utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id",// Ad-network click ids
|
|
828
828
|
"gclid","gbraid","wbraid","fbclid","msclkid","ttclid","twclid","li_fat_id","dclid",// OAuth / OIDC — see the SECURITY note above
|
|
829
|
-
"client_id","redirect_uri","response_type","scope","state","code","nonce",// Pagination
|
|
830
|
-
"page","limit","offset","cursor","per_page"
|
|
829
|
+
"client_id","redirect_uri","response_type","scope","state","code","nonce",// Pagination
|
|
830
|
+
"page","limit","offset","cursor","per_page",// Site search term, as the common platforms spell it. Matching is
|
|
831
|
+
// case-insensitive; single-letter names other than `q` are too generic.
|
|
832
|
+
"q","search","query","keyword","keywords","term","text","searchTerm","searchText","search_query","search_text","Ntt",// Product and variant identifiers. `cid` is not a category: it is a
|
|
833
|
+
// customer id on many sites.
|
|
834
|
+
"pid","productId","sku","skuId","variant",// Category
|
|
835
|
+
"category",// Referral
|
|
831
836
|
"ref","referrer"];// ---------------------------------------------------------------------------
|
|
832
837
|
// Pure helpers. No `this`, no globals, no side effects — callable and assertable
|
|
833
838
|
// on their own, which is where the interesting rules live.
|
package/dist/mparticle.esm.js
CHANGED
|
@@ -15,7 +15,7 @@ map:function map(a,b){var c,d,e;if(null===this)throw new TypeError(" this is nul
|
|
|
15
15
|
filter:function filter(a/*, thisArg*/){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=2<=arguments.length?arguments[1]:void 0,f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g);}return d},// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
|
|
16
16
|
isArray:function isArray(a){return "[object Array]"===Object.prototype.toString.call(a)},Base64:Base64$1};
|
|
17
17
|
|
|
18
|
-
var version = "3.
|
|
18
|
+
var version = "3.3.1";
|
|
19
19
|
|
|
20
20
|
var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodHasBeenDeprecated:"has been deprecated.",MethodMarkedForDeprecationPostfix:"is a deprecated method and will be removed in future releases.",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally
|
|
21
21
|
},DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},// These are the paths that are used to construct the CNAME urls
|
|
@@ -826,8 +826,13 @@ var WIN_APV_KEY="__mpApv__";// The query params an auto page view may carry. An
|
|
|
826
826
|
var ALLOWED_QUERY_PARAMS=[// Campaign attribution
|
|
827
827
|
"utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id",// Ad-network click ids
|
|
828
828
|
"gclid","gbraid","wbraid","fbclid","msclkid","ttclid","twclid","li_fat_id","dclid",// OAuth / OIDC — see the SECURITY note above
|
|
829
|
-
"client_id","redirect_uri","response_type","scope","state","code","nonce",// Pagination
|
|
830
|
-
"page","limit","offset","cursor","per_page"
|
|
829
|
+
"client_id","redirect_uri","response_type","scope","state","code","nonce",// Pagination
|
|
830
|
+
"page","limit","offset","cursor","per_page",// Site search term, as the common platforms spell it. Matching is
|
|
831
|
+
// case-insensitive; single-letter names other than `q` are too generic.
|
|
832
|
+
"q","search","query","keyword","keywords","term","text","searchTerm","searchText","search_query","search_text","Ntt",// Product and variant identifiers. `cid` is not a category: it is a
|
|
833
|
+
// customer id on many sites.
|
|
834
|
+
"pid","productId","sku","skuId","variant",// Category
|
|
835
|
+
"category",// Referral
|
|
831
836
|
"ref","referrer"];// ---------------------------------------------------------------------------
|
|
832
837
|
// Pure helpers. No `this`, no globals, no side effects — callable and assertable
|
|
833
838
|
// on their own, which is where the interesting rules live.
|
package/dist/mparticle.js
CHANGED
|
@@ -204,7 +204,7 @@ var mParticle = (function () {
|
|
|
204
204
|
Base64: Base64$1
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
-
var version = "3.
|
|
207
|
+
var version = "3.3.1";
|
|
208
208
|
|
|
209
209
|
var Constants = {
|
|
210
210
|
sdkVersion: version,
|
|
@@ -6404,8 +6404,16 @@ var mParticle = (function () {
|
|
|
6404
6404
|
'gclid', 'gbraid', 'wbraid', 'fbclid', 'msclkid', 'ttclid', 'twclid', 'li_fat_id', 'dclid',
|
|
6405
6405
|
// OAuth / OIDC — see the SECURITY note above
|
|
6406
6406
|
'client_id', 'redirect_uri', 'response_type', 'scope', 'state', 'code', 'nonce',
|
|
6407
|
-
// Pagination
|
|
6408
|
-
'page', 'limit', 'offset', 'cursor', 'per_page',
|
|
6407
|
+
// Pagination
|
|
6408
|
+
'page', 'limit', 'offset', 'cursor', 'per_page',
|
|
6409
|
+
// Site search term, as the common platforms spell it. Matching is
|
|
6410
|
+
// case-insensitive; single-letter names other than `q` are too generic.
|
|
6411
|
+
'q', 'search', 'query', 'keyword', 'keywords', 'term', 'text', 'searchTerm', 'searchText', 'search_query', 'search_text', 'Ntt',
|
|
6412
|
+
// Product and variant identifiers. `cid` is not a category: it is a
|
|
6413
|
+
// customer id on many sites.
|
|
6414
|
+
'pid', 'productId', 'sku', 'skuId', 'variant',
|
|
6415
|
+
// Category
|
|
6416
|
+
'category',
|
|
6409
6417
|
// Referral
|
|
6410
6418
|
'ref', 'referrer'];
|
|
6411
6419
|
// ---------------------------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mparticle/web-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "mParticle core SDK for web applications",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"build:esm": "cross-env ENVIRONMENT=prod BUILD=esm rollup --config rollup.config.js",
|
|
42
42
|
"build:stub": "cross-env ENVIRONMENT=prod BUILD=stub rollup --config rollup.config.js",
|
|
43
43
|
"build:snippet": "npm run build:snippet:mp && npm run build:snippet:rokt",
|
|
44
|
-
"build:snippet:mp": "uglifyjs snippet.js -m -o snippet.min.js",
|
|
45
|
-
"build:snippet:rokt": "uglifyjs snippet.rokt.js -m -o snippet.rokt.min.js",
|
|
44
|
+
"build:snippet:mp": "prettier --write snippet.js && uglifyjs snippet.js -m -o snippet.min.js",
|
|
45
|
+
"build:snippet:rokt": "prettier --write snippet.rokt.js && uglifyjs snippet.rokt.js -m -o snippet.rokt.min.js",
|
|
46
46
|
"build:tests": "cross-env ENVIRONMENT=prod TESTTYPE=main rollup --config rollup.test.config.js",
|
|
47
47
|
"build:test-bundle": "cross-env TESTTYPE=main ENVIRONMENT=prod rollup --config rollup.test.config.js",
|
|
48
48
|
"build:browserify:cjs": "browserify test/integrations/cjs/browserify/index.js -o test/integrations/cjs/dist/browserify-output.js",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"test:karma:webpack:module": "cross-env BUNDLER=webpack karma start test/integrations/module/karma.webpack.config.js",
|
|
77
77
|
"test:karma:rollup:module": "cross-env BUNDLER=rollup karma start test/integrations/module/karma.rollup.config.js",
|
|
78
78
|
"test:jest": "jest --config jest.config.js",
|
|
79
|
+
"test:jest:coverage": "jest --config jest.config.js --coverage",
|
|
79
80
|
"test:jest:watch": "jest --config jest.config.js --watch",
|
|
80
81
|
"watch": "cross-env ENVIRONMENT=dev BUILD=iife rollup --config rollup.config.js -w",
|
|
81
82
|
"watch:all": "cross-env ENVIRONMENT=prod BUILDALL=true rollup --config rollup.config.js -w",
|
package/src/pageViewTracker.ts
CHANGED
|
@@ -81,14 +81,38 @@ export const ALLOWED_QUERY_PARAMS: string[] = [
|
|
|
81
81
|
'code',
|
|
82
82
|
'nonce',
|
|
83
83
|
|
|
84
|
-
// Pagination
|
|
84
|
+
// Pagination
|
|
85
85
|
'page',
|
|
86
86
|
'limit',
|
|
87
87
|
'offset',
|
|
88
88
|
'cursor',
|
|
89
89
|
'per_page',
|
|
90
|
+
|
|
91
|
+
// Site search term, as the common platforms spell it. Matching is
|
|
92
|
+
// case-insensitive; single-letter names other than `q` are too generic.
|
|
90
93
|
'q',
|
|
91
94
|
'search',
|
|
95
|
+
'query',
|
|
96
|
+
'keyword',
|
|
97
|
+
'keywords',
|
|
98
|
+
'term',
|
|
99
|
+
'text',
|
|
100
|
+
'searchTerm',
|
|
101
|
+
'searchText',
|
|
102
|
+
'search_query',
|
|
103
|
+
'search_text',
|
|
104
|
+
'Ntt', // Endeca
|
|
105
|
+
|
|
106
|
+
// Product and variant identifiers. `cid` is not a category: it is a
|
|
107
|
+
// customer id on many sites.
|
|
108
|
+
'pid',
|
|
109
|
+
'productId',
|
|
110
|
+
'sku',
|
|
111
|
+
'skuId',
|
|
112
|
+
'variant',
|
|
113
|
+
|
|
114
|
+
// Category
|
|
115
|
+
'category',
|
|
92
116
|
|
|
93
117
|
// Referral
|
|
94
118
|
'ref',
|