diff --git a/lib/templates/plugin.js b/lib/templates/plugin.js index 4d2d6fa..1952d94 100644 --- a/lib/templates/plugin.js +++ b/lib/templates/plugin.js @@ -51,12 +51,18 @@ class Fb { /** * @method track */ - track (event = null, parameters = null) { + track (event = null, parameters = null, eventID = null) { if (!event) { event = this.options.track } + if (!eventID) { + this.query('track', event, parameters) + } else { + + this.query('track', event, parameters, eventID) + } + - this.query('track', event, parameters) } /** @@ -64,15 +70,19 @@ class Fb { * @param {string} cmd * @param {object} option * @param {object} parameters + * @param {object} eventID */ - query (cmd, option, parameters = null) { - if (this.options.debug) log('Command:', cmd, 'Option:', option, 'Additional parameters:', parameters) + query (cmd, option, parameters = null, eventID = null) { + if (this.options.debug) log('Command:', cmd, 'Option:', option, 'Additional parameters:', parameters, "EventID:", eventID) if (!this.isEnabled) return if (!parameters) { this.fbq(cmd, option) - } else { + } + else if (!eventID) { this.fbq(cmd, option, parameters) + } else { + this.fbq(cmd, option, parameters, eventID) } } }