react-marketing-tools 0.2.6 → 0.2.8

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Rory Fairweather
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
 
4
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
5
 
6
- COMING SOON: [React Marketing Tools Demo](https://)
7
- - For now you can clone and run locally. There is a very basic demo app, thanks to [Vite.](https://vitejs.dev/)
6
+ [React Marketing Tools Demo](https://codepen.io/roryfn/pen/OJBGvMG)
7
+ [Detailed Blog post on React Marketing Tools Implementation](https://blog.heyrory.com/google-analytics-4-google-tag-manager)
8
8
 
9
9
 
10
10
  # PR's
@@ -32,7 +32,7 @@ COMING SOON: [React Marketing Tools Demo](https://)
32
32
  TOKENS are optional
33
33
  const TOKENS: Tokens = {
34
34
 
35
- // if withDeviceInfo is true you must supply this token.
35
+ // if withServerLocationInfo is true you must supply this token.
36
36
  IP_INFO_TOKEN: 'SOME_TOKEN',
37
37
 
38
38
  // if analyticsType = analyticsPlatform.GOOGLE the below tokens must be supplied.
@@ -128,6 +128,8 @@ COMING SOON: [React Marketing Tools Demo](https://)
128
128
 
129
129
  const sendAnalyticsEvent = async () => {
130
130
  const eventNameInfo: EventNameInfo = {
131
+ // If this is not passed in the event name will be a combination of actionPrefix & globalAppEvent
132
+ // J_UNAUTHENTICATED
131
133
  eventName: 'Welcome Landing',
132
134
  actionPrefix: eventActionPrefixList.JOURNEY,
133
135
  globalAppEvent: analyticsGlobalEventActionList.UNAUTHENTICATED,
@@ -152,6 +154,8 @@ COMING SOON: [React Marketing Tools Demo](https://)
152
154
  setCount(countActual)
153
155
 
154
156
  const eventNameInfo: EventNameInfo = {
157
+ // If this is not passed in the event name will be a combination of actionPrefix & globalAppEvent
158
+ // I_AUTHENTICATED
155
159
  eventName: 'count button click',
156
160
  actionPrefix: eventActionPrefixList.INTERACTION,
157
161
  globalAppEvent: analyticsGlobalEventActionList.AUTHENTICATED,
@@ -219,64 +223,4 @@ COMING SOON: [React Marketing Tools Demo](https://)
219
223
  ```
220
224
 
221
225
  ## Usage without Provider
222
- ```js
223
- import { useState, useEffect, useCallback } from 'react'
224
- import { trackAnalyticsEvent, analyticsPlatform } from "react-marketing-tools";
225
- import { EventNameInfo, TrackAnalyticsEventOptions } from './lib/types'
226
-
227
- const WelcomePage = () => {
228
- useEffect(function appLoadPageLandingWelcome() {
229
- const sendAnalyticsEvent = async () => {
230
- const eventNameInfo: EventNameInfo = {
231
- actionPrefix: eventActionPrefixList.JOURNEY,
232
- description: 'Welcome Landing',
233
- globalAppEvent: analyticsGlobalEventActionList.UNAUTHENTICATED,
234
- }
235
-
236
- const trackingData: TrackAnalyticsEventOptions = {
237
- data: {},
238
- eventNameInfo,
239
- analyticsType: analyticsPlatform.DATALAYER_PUSH,
240
- dataLayerCheck: true,
241
- }
242
-
243
- await trackAnalyticsEvent(trackingData)
244
- }
245
-
246
- sendAnalyticsEvent()
247
- })
248
-
249
- const handleButtonClick = async () => {
250
- const countActual = count + 1
251
- setCount(countActual)
252
-
253
- const eventNameInfo: EventNameInfo = {
254
- eventName: 'count button click',
255
- actionPrefix: eventActionPrefixList.INTERACTION,
256
- globalAppEvent: analyticsGlobalEventActionList.AUTHENTICATED,
257
- previousGlobalAppEvent: analyticsGlobalEventActionList.UNAUTHENTICATED
258
- }
259
-
260
- const trackingData: TrackAnalyticsEventOptions = {
261
- data: {
262
- count: countActual,
263
- firstName: 'bob',
264
- lastName: 'yeah nah',
265
- email: 'yeahnah@gmail.com',
266
- },
267
- eventNameInfo,
268
- analyticsType: analyticsPlatform.DATALAYER_PUSH,
269
- consoleLogData: {
270
- showJourneyPropsPayload: true
271
- }
272
- }
273
-
274
- await trackAnalyticsEvent(trackingData)
275
- }
276
- ...
277
-
278
- return (
279
- ...
280
- )
281
- }
282
- ```
226
+ > To view implementation and usage without the React Context/Provider visit this [codepen](https://codepen.io/roryfn/pen/OJBGvMG)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "src/lib/index.tsx": {
3
3
  "file": "react-marketing-tools.umd.js",
4
- "src": "src/lib/index.tsx",
5
- "isEntry": true
4
+ "isEntry": true,
5
+ "src": "src/lib/index.tsx"
6
6
  }
7
7
  }