-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bingads #226
Bingads #226
Conversation
integrations/BingAds/browser.js
Outdated
*/ | ||
|
||
track(rudderElement) { | ||
const typeofcall = rudderElement.message.type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets destructure this.
const { type, properties } = rudderElement.message
Also, destructure the properties
const {category,currency,etc) = properties
integrations/BingAds/browser.js
Outdated
var event = { | ||
ea: typeofcall | ||
}; | ||
if (properties.category) event.ec = properties.category; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets use like
event.ec = category ? category : null
integrations/BingAds/browser.js
Outdated
if (properties.category) event.ec = properties.category; | ||
if (properties.currency) event.gc = properties.currency; | ||
if (properties.value) event.gv = properties.value; | ||
if (properties.label) event.el = properties.label; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we need ea? (event action)
integrations/BingAds/browser.js
Outdated
|
||
init() { | ||
logger.debug("===in init BingAds==="); | ||
console.log(window); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove console
integrations/BingAds/browser.js
Outdated
} | ||
|
||
loadBingadsScript() { | ||
var apikey = this.apikey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets follow es6. dont use var. here use destructuring.
const.
integrations/BingAds/browser.js
Outdated
@@ -0,0 +1,66 @@ | |||
import logger from "../../utils/logUtil"; | |||
import ScriptLoader from "../ScriptLoader"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this import
integrations/BingAds/browser.js
Outdated
this.loadBingadsScript(); | ||
} | ||
|
||
isLoaded() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isLoaded = () => use this type of syntax for all the function. read about this too.
integrations/BingAds/browser.js
Outdated
window.uetq.push(event); | ||
} | ||
|
||
page(rudderElement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to pass rudderelement as it is not used in the function
integrations/BingAds/browser.js
Outdated
track(rudderElement) { | ||
const typeofcall = rudderElement.message.type; | ||
const properties = rudderElement.message.properties; | ||
var event = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont use var
Replaced var with let.
integrations/BingAds/browser.js
Outdated
let event = { | ||
ea: type | ||
}; | ||
if (category) event.ec = category; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (category) event.ec = category; | |
if (category) { | |
event.ec = category; | |
} |
For better readability. Also, apply the same to others.
if (currency) { | ||
event.gc = currency; | ||
} | ||
if (value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like revenue value.
Do we support other keys where revenue can come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is revenue value, it is used to set BingAds gv (Variable revenue currency) parameter.
For now, we support only one key.
More detail: Revenue comes from properties fields: e.g.,
rudderanalytics.track('track conversion', { category: 'MyCategory', value: 125, currency: 'INR', order_id: 'order_1' });
What changes will I need to do, please suggest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think revenue and total can also be considered as valid keys.
@ruchiramoitra plz confirm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we should consider them too... value, revenue, total
integrations/BingAds/browser.js
Outdated
@@ -56,6 +56,13 @@ class BingAds { | |||
if (value) { | |||
event.gv = value; | |||
} | |||
else if(revenue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use if's only to keep parity with others.
Also update the doc accordingly, the highest preference is total > revenue > value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check it once more. If any other changes is needed or not.
Else is removed.
Description of the change
Type of change
Related issues
Checklists
Development
Code review
This change is