Skip to content
This repository was archived by the owner on Oct 17, 2020. It is now read-only.

Commit f404556

Browse files
committed
Only create a tracker and fire a page view is config was passed
1 parent accd796 commit f404556

2 files changed

Lines changed: 16 additions & 23 deletions

File tree

dist/GoogleAnalytics.js

Lines changed: 9 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GoogleAnalytics.litcoffee

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,18 @@ for holding an event queue whilst Google Analytics downloads.
3232
3333
super()
3434
35-
unless @config.fields and @config.fields.name
36-
console.log 'GA: Created tracker for ' + @config.id
37-
else
38-
console.log 'GA: Created ' + @config.fields.name + ' for ' + @config.id
39-
40-
@create @config.id, @config.fields
35+
if @config.id?
36+
@create @config.id, @config.fields
4137
4238
Set the chosen variation for the Visitor for
4339
[experiments](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#experiments).
4440

45-
if @config.expId # The id of the experiment the user has been exposed to.
46-
@set 'expId', @config.expId
47-
if @config.expVar # The index of the variation shown to the visitor.
48-
@set 'expVar', @config.expVar
41+
if @config.expId # The id of the experiment the user has been exposed to.
42+
@set 'expId', @config.expId
43+
if @config.expVar # The index of the variation shown to the visitor.
44+
@set 'expVar', @config.expVar
4945
50-
@view()
46+
@view()
5147
5248
unless @config.ga
5349
# Load the actual Google Analytics library

0 commit comments

Comments
 (0)