react-marketing-tools 0.0.3 → 0.0.6
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 +16 -0
- package/dist/react-marketing-tools.es.js +2596 -2593
- package/dist/react-marketing-tools.umd.js +13 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,6 +45,7 @@ COMING SOON: [React Marketing Tools Demo](https://)
|
|
|
45
45
|
|
|
46
46
|
const analyticsConfig = {
|
|
47
47
|
appName: 'my-awesome-app', // required
|
|
48
|
+
appSessionCookieName: 'APP_SESSION',
|
|
48
49
|
eventActionPrefix: { // this will extend the default values of eventActionPrefix
|
|
49
50
|
ACTION: 'ACTION',
|
|
50
51
|
OTHER_EVENT_NAME_TYPE: 'OTHER_EVENT_NAME_TYPE'
|
|
@@ -60,6 +61,17 @@ COMING SOON: [React Marketing Tools Demo](https://)
|
|
|
60
61
|
withServerLocationInfo: false, // (optional) has default value
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
/**
|
|
65
|
+
* @type {Object} buildConfig -> options: all attributes of the options object must have a value, other than withDeviceInfo.
|
|
66
|
+
* @property {string} appName: the name of your app this value must be passed in.
|
|
67
|
+
* @property {string} appSessionCookieName This is used to get the cookie from storage based on a key you use, the value from the cookie will be used in "client_id:"
|
|
68
|
+
* @property {Object} eventActionPrefix: is a { key: 'value' } object that allows you to extend "analyticsEventActionPrefixList" object with custom eventActionPrefix. To see the build in list call the function showMeBuildInEventActionPrefixList().
|
|
69
|
+
* @property {Array} globalEventActionList: is a { key: 'value' } object that allows you to extend "analyticsGlobalEventActionList" object with custom eventActionNames. To see the build in list call the function showMeBuildInGlobalEventActionList().
|
|
70
|
+
* @property {Array} includeUserKeys: is an array of strings that represent keys from your user data that you want to whitelist, user data you wan to hash.
|
|
71
|
+
* @property {Object} TOKENS: is a { key: 'value' } object that includes the following keys, IP_INFO_TOKEN, GA4_PUBLIC_API_SECRET, GA4_PUBLIC_MEASUREMENT_ID, depending on if you need these features enabled.
|
|
72
|
+
* @property {Boolean} withDeviceInfo: if you want device information added to "globalVars" set this to true false by default.
|
|
73
|
+
* @property {Boolean} withServerLocationInfo: if you want server information added to "journeyProps" set this to true false by default.
|
|
74
|
+
*/
|
|
63
75
|
buildConfig(analyticsConfig)
|
|
64
76
|
|
|
65
77
|
ReactDOM.createRoot(document.getElementById('root')).render(
|
|
@@ -80,6 +92,7 @@ COMING SOON: [React Marketing Tools Demo](https://)
|
|
|
80
92
|
function App() {
|
|
81
93
|
const [count, setCount] = useState(0)
|
|
82
94
|
const {
|
|
95
|
+
appSessionCookieName,
|
|
83
96
|
analyticsPlatform,
|
|
84
97
|
eventActionPrefixList,
|
|
85
98
|
analyticsGlobalEventActionList
|
|
@@ -96,6 +109,9 @@ COMING SOON: [React Marketing Tools Demo](https://)
|
|
|
96
109
|
} = useMarketingApi(ContextApi)
|
|
97
110
|
|
|
98
111
|
useEffect(function appLoadPageLandingWelcome() {
|
|
112
|
+
// create session cookie, useful for unauthenticated user tracking and other things
|
|
113
|
+
document.cookie = `${appSessionCookieName}=${uuid()};max-age=${70};SameSite=Strict;Secure`
|
|
114
|
+
|
|
99
115
|
const eventNameInfo = {
|
|
100
116
|
actionPrefix: eventActionPrefixList.JOURNEY,
|
|
101
117
|
description: 'Welcome Landing',
|