Skip to content

Commit

Permalink
feat: add eventID feature (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
jungfish authored Feb 24, 2023
1 parent 0872bae commit 941d888
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions lib/templates/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,38 @@ 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)
}

/**
* @method query
* @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)
}
}
}
Expand Down

0 comments on commit 941d888

Please sign in to comment.