Skip to content

Commit

Permalink
feat: add-script-path-config-param
Browse files Browse the repository at this point in the history
feat: add scriptSrc param
  • Loading branch information
Victor Chaptsev committed Apr 23, 2019
2 parents f08d42e + c2b2e22 commit 8251748
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ let config = {
},
router: null,
env: 'development',
scriptSrc: 'https://mc.yandex.ru/metrika/tag.js',
debug: false,
ignoreRoutes: [],
skipSamePath: true
Expand Down
4 changes: 2 additions & 2 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ export function checkConfig () {
if (!config.router && config.env !== 'production') {return console.warn('[vue-yandex-metrika] Router is not passed, autotracking is disabled')}
}

export function loadScript (callback) {
export function loadScript (callback, scriptSrc) {
var head = document.head || document.getElementsByTagName('head')[0]
const script = document.createElement('script')

script.async = true
script.charset = 'utf8'
script.src = 'https://mc.yandex.ru/metrika/tag.js'
script.src = scriptSrc

head.appendChild(script)

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export default function install (Vue, options = {}) {
loadScript(() => { // Load Metrika script
const metrika = createMetrika(Vue) // Create Metrika
startTracking(metrika) // Start autotracking
})
}, options.scriptSrc)
}

0 comments on commit 8251748

Please sign in to comment.