Skip to content

Commit

Permalink
fix: ensure amplitude_api_key is set
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebolam committed Jan 27, 2019
1 parent 818d0ba commit 90c1f7b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/utils/Analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ const nodeFetch = require('node-fetch')
const { URLSearchParams } = require('url')

class Analytics {
constructor({ user, repo, owner, apiKey, log, funnelId }) {
constructor({
user,
repo,
owner,
apiKey = process.env.AMPLITUDE_API_KEY,
log,
funnelId = uuid.v4(),
}) {
this.user = user
this.repo = repo
this.owner = owner
this.eventPromises = []
this.funnel_id = funnelId || uuid.v4()
this.apiKey = apiKey || process.env.AMPLITUDE_API_KEY
this.funnelId = funnelId
this.apiKey = apiKey
this.log = log
}

Expand All @@ -26,7 +33,7 @@ class Analytics {
owner: this.owner,
},
event_properties: {
funnel_id: this.funnel_id,
funnel_id: this.funnelId,
...metadata,
},
}
Expand Down

0 comments on commit 90c1f7b

Please # to comment.