diff --git a/README.md b/README.md index 5b41062d..60c639ed 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,17 @@ This plugin uses the ember-cli project's configuration as defined in `config/env Add your heap projectId to `config/environment.js` and you're good to go. +Starting from version 3.0.0 we now support multiple pixel ids: +```js +// environment.js + + ENV.fbq = { + enabled: true, + ids: ['xxxxxxxxxxxxxxx', 'yyyyyyyyyyyyyyy'] + } +``` + +Before version 3.0.0: ```js // environment.js diff --git a/index.js b/index.js index 07a4d05a..655b8e27 100644 --- a/index.js +++ b/index.js @@ -5,8 +5,12 @@ module.exports = { name: 'ember-cli-fbq', contentFor: function(type, config) { - if (type === 'head-footer' && config.fbq && config.fbq.enabled && config.fbq.id) { - return '' + if (type === 'head-footer' && config.fbq && config.fbq.enabled && config.fbq.ids) { + let initIds = ''; + config.fbq.ids.forEach(id => { + initIds += 'fbq("init", "' + id + '");' + }); + return '' } } }; diff --git a/package.json b/package.json index 98cfcdcf..11a57c3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ember-cli-fbq", - "version": "2.0.0", + "version": "3.0.0", "description": "An Ember CLI Addon to add support for Facebook Pixel", "keywords": [ "ember-addon",