Skip to content
This repository was archived by the owner on Mar 14, 2024. It is now read-only.

Commit 991406d

Browse files
committed
Update script to allow optional protocol to be set in object props
1 parent cba5239 commit 991406d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.coffee

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ ga.Initializer = React.createClass
2727
displayName: 'GAInitializer'
2828
componentDidMount: ->
2929
window[window.GoogleAnalyticsObject].l = new Date().getTime()
30-
@addScript() unless scriptIsAdded
31-
addScript: ->
30+
@addScript(this.props.protocol || 'https') unless scriptIsAdded
31+
addScript: (protocol) ->
3232
# script tags added in `render()` aren't evaluated so we need to mutate the
3333
# DOM.
3434
scriptIsAdded = true
3535
el = document.createElement 'script'
3636
el.type = 'text/javascript'
3737
el.async = true
38-
el.src = '//www.google-analytics.com/analytics.js'
38+
el.src = protocol + '://www.google-analytics.com/analytics.js'
3939
s = document.getElementsByTagName('script')[0]
4040
s.parentNode.insertBefore el, s
4141
render: ->

0 commit comments

Comments
 (0)