react-redux-analytics-sitecatalyst
Advanced tools
Comparing version 0.0.2 to 0.0.4-rc1
@@ -107,5 +107,3 @@ 'use strict'; | ||
var s = this.s; | ||
this.optionCreator(s); | ||
this.refreshSObject(); | ||
//document.referrer is correct only at the first page | ||
@@ -127,12 +125,14 @@ this.location = { | ||
this.refreshSObject(); | ||
//referrer has to be set manually with SPA | ||
this.location.referrer = this.location.current; | ||
this.location.current = location || this.location.current; | ||
} | ||
}, { | ||
key: 'refreshSObject', | ||
value: function refreshSObject() { | ||
var s = this.s; | ||
//emulate page refreshing in regards to s object. | ||
(0, _utils.clearSObject)(this.config.clearFields)(s); | ||
this.optionCreator(s); | ||
//referrer has to be set manually with SPA | ||
this.location.referrer = this.location.current; | ||
this.location.current = location || this.location.current; | ||
return s; | ||
} | ||
@@ -181,5 +181,4 @@ | ||
if (!this.isFirstPageView) { | ||
debug('firstPage() has to be called before sending metrics'); | ||
return; | ||
if (this.isFirstPageView) { | ||
this.refreshSObject(); | ||
} | ||
@@ -203,7 +202,7 @@ | ||
if (!s.useForcedLinkTracking) { | ||
s.tl(true, linkType, linkName || s.linkName || '', composedVars); | ||
s.tl(true, linkType, linkName || s.linkName || 'unknown', composedVars); | ||
return Promise.resolve(); | ||
} else { | ||
return new Promise(function (resolve) { | ||
s.tl(true, linkType, linkName || s.linkName || '', composedVars, function () { | ||
s.tl(true, linkType, linkName || s.linkName || 'unknown', composedVars, function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -210,0 +209,0 @@ args[_key] = arguments[_key]; |
@@ -54,2 +54,3 @@ 'use strict'; | ||
siteCatalyst.trackLink({ | ||
linkName: payload.eventName, | ||
variables: payload.variables | ||
@@ -56,0 +57,0 @@ }); |
{ | ||
"name": "react-redux-analytics-sitecatalyst", | ||
"version": "0.0.2", | ||
"version": "0.0.4-rc1", | ||
"description": "SiteCatalyst plugin for react-redux-analytics", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -62,5 +62,3 @@ //jscs:disable | ||
firstPage({ location }) { | ||
const s = this.s | ||
this.optionCreator(s) | ||
this.refreshSObject() | ||
//document.referrer is correct only at the first page | ||
@@ -76,12 +74,13 @@ this.location = { | ||
pageChanged({ location = null }) { | ||
this.refreshSObject() | ||
//referrer has to be set manually with SPA | ||
this.location.referrer = this.location.current | ||
this.location.current = location || this.location.current | ||
} | ||
refreshSObject(){ | ||
const s = this.s | ||
//emulate page refreshing in regards to s object. | ||
clearSObject(this.config.clearFields)(s) | ||
this.optionCreator(s) | ||
//referrer has to be set manually with SPA | ||
this.location.referrer = this.location.current | ||
this.location.current = location || this.location.current | ||
return s | ||
} | ||
@@ -113,5 +112,4 @@ | ||
}) { | ||
if (!this.isFirstPageView) { | ||
debug('firstPage() has to be called before sending metrics') | ||
return | ||
if (this.isFirstPageView) { | ||
this.refreshSObject() | ||
} | ||
@@ -129,7 +127,7 @@ | ||
if (!s.useForcedLinkTracking) { | ||
s.tl(true, linkType, linkName || s.linkName || '', composedVars) | ||
s.tl(true, linkType, linkName || s.linkName || 'unknown', composedVars) | ||
return Promise.resolve() | ||
}else { | ||
return new Promise((resolve) => { | ||
s.tl(true, linkType, linkName || s.linkName || '', composedVars, (...args) => resolve(args)) | ||
s.tl(true, linkType, linkName || s.linkName || 'unknown', composedVars, (...args) => resolve(args)) | ||
}) | ||
@@ -136,0 +134,0 @@ } |
@@ -32,2 +32,3 @@ import { isFunction } from 'lodash/fp' | ||
siteCatalyst.trackLink({ | ||
linkName: payload.eventName, | ||
variables: payload.variables, | ||
@@ -34,0 +35,0 @@ }) |
30904
714