react-marketing-tools 0.0.2 → 0.0.5

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 CHANGED
@@ -1,10 +1,11 @@
1
1
 
2
2
  # React Marketing Tools   [![npm version](https://badge.fury.io/js/react-marketing-tools.svg)](https://badge.fury.io/js/react-marketing-tools)
3
3
 
4
+ React Marketing Tools are a set of tools to make it easier for you to implement analytics and track user journeys, interactions throughout your App. using dataLayer/Google Tag Manager, GA4 fetch directly or coming soon facebook pixel.
5
+
4
6
  COMING SOON: [React Marketing Tools Demo](https://)
5
7
  - For now you can clone and run locally. There is a very basic demo app, thanks to [Vite.](https://vitejs.dev/)
6
8
 
7
- React Marketing Tools are a set of tools to make it easier for you to implement analytics and track user journeys, interactions throughout your App. using dataLayer/Google Tag Manager, GA4 fetch directly or coming soon facebook pixel.
8
9
 
9
10
  # PR's
10
11
  - Have a look at the [PR template doc](https://github.com/bronz3beard/react-marketing-tools/blob/main/docs) for best approach to getting your pr merged.
@@ -44,6 +45,7 @@ React Marketing Tools are a set of tools to make it easier for you to implement
44
45
 
45
46
  const analyticsConfig = {
46
47
  appName: 'my-awesome-app', // required
48
+ appSessionCookieName: 'APP_SESSION',
47
49
  eventActionPrefix: { // this will extend the default values of eventActionPrefix
48
50
  ACTION: 'ACTION',
49
51
  OTHER_EVENT_NAME_TYPE: 'OTHER_EVENT_NAME_TYPE'
@@ -59,6 +61,17 @@ React Marketing Tools are a set of tools to make it easier for you to implement
59
61
  withServerLocationInfo: false, // (optional) has default value
60
62
  }
61
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
+ */
62
75
  buildConfig(analyticsConfig)
63
76
 
64
77
  ReactDOM.createRoot(document.getElementById('root')).render(
@@ -79,6 +92,7 @@ React Marketing Tools are a set of tools to make it easier for you to implement
79
92
  function App() {
80
93
  const [count, setCount] = useState(0)
81
94
  const {
95
+ appSessionCookieName,
82
96
  analyticsPlatform,
83
97
  eventActionPrefixList,
84
98
  analyticsGlobalEventActionList
@@ -95,6 +109,9 @@ React Marketing Tools are a set of tools to make it easier for you to implement
95
109
  } = useMarketingApi(ContextApi)
96
110
 
97
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
+
98
115
  const eventNameInfo = {
99
116
  actionPrefix: eventActionPrefixList.JOURNEY,
100
117
  description: 'Welcome Landing',