Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
d4b8735c
Unverified
Commit
d4b8735c
authored
Sep 19, 2022
by
vignesh mohankumar
Committed by
GitHub
Sep 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: remove sendTestAnalyticsEvent (#4653)
* fix: remove sendTestAnalyticsEvent * comments
parent
d31687d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
12 deletions
+5
-12
index.ts
src/components/AmplitudeAnalytics/index.ts
+5
-12
No files found.
src/components/AmplitudeAnalytics/index.ts
View file @
d4b8735c
import
{
Identify
,
identify
,
init
,
track
}
from
'
@amplitude/analytics-browser
'
import
{
Identify
,
identify
,
init
,
track
}
from
'
@amplitude/analytics-browser
'
import
{
isProductionEnv
}
from
'
utils/env
'
import
{
isProductionEnv
}
from
'
utils/env
'
const
API_KEY
=
isProductionEnv
()
?
process
.
env
.
REACT_APP_AMPLITUDE_KEY
:
process
.
env
.
REACT_APP_AMPLITUDE_TEST_KEY
/**
/**
* Initializes Amplitude with API key for project.
* Initializes Amplitude with API key for project.
*
*
...
@@ -8,8 +10,6 @@ import { isProductionEnv } from 'utils/env'
...
@@ -8,8 +10,6 @@ import { isProductionEnv } from 'utils/env'
* member of the organization on Amplitude to view details.
* member of the organization on Amplitude to view details.
*/
*/
export
function
initializeAnalytics
()
{
export
function
initializeAnalytics
()
{
const
API_KEY
=
isProductionEnv
()
?
process
.
env
.
REACT_APP_AMPLITUDE_KEY
:
process
.
env
.
REACT_APP_AMPLITUDE_TEST_KEY
if
(
typeof
API_KEY
===
'
undefined
'
)
{
if
(
typeof
API_KEY
===
'
undefined
'
)
{
const
keyName
=
isProductionEnv
()
?
'
REACT_APP_AMPLITUDE_KEY
'
:
'
REACT_APP_AMPLITUDE_TEST_KEY
'
const
keyName
=
isProductionEnv
()
?
'
REACT_APP_AMPLITUDE_KEY
'
:
'
REACT_APP_AMPLITUDE_TEST_KEY
'
console
.
error
(
`
${
keyName
}
is undefined, Amplitude analytics will not run.`
)
console
.
error
(
`
${
keyName
}
is undefined, Amplitude analytics will not run.`
)
...
@@ -33,23 +33,16 @@ export function initializeAnalytics() {
...
@@ -33,23 +33,16 @@ export function initializeAnalytics() {
)
)
}
}
/** Sends an
approved (finalized) event to Amplitude production project
. */
/** Sends an
event to Amplitude
. */
export
function
sendAnalyticsEvent
(
eventName
:
string
,
eventProperties
?:
Record
<
string
,
unknown
>
)
{
export
function
sendAnalyticsEvent
(
eventName
:
string
,
eventProperties
?:
Record
<
string
,
unknown
>
)
{
if
(
!
isProductionEnv
()
)
{
if
(
!
API_KEY
)
{
console
.
log
(
`[a
mplitude
(
${
eventName
}
)]:
${
JSON
.
stringify
(
eventProperties
)}
`
)
console
.
log
(
`[a
nalytics
(
${
eventName
}
)]:
${
JSON
.
stringify
(
eventProperties
)}
`
)
return
return
}
}
track
(
eventName
,
eventProperties
)
track
(
eventName
,
eventProperties
)
}
}
/** Sends a draft event to Amplitude test project. */
export
function
sendTestAnalyticsEvent
(
eventName
:
string
,
eventProperties
?:
Record
<
string
,
unknown
>
)
{
if
(
isProductionEnv
())
return
track
(
eventName
,
eventProperties
)
}
type
Value
=
string
|
number
|
boolean
|
string
[]
|
number
[]
type
Value
=
string
|
number
|
boolean
|
string
[]
|
number
[]
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment