Skip to content
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

Generic Analytics, event names throw warning #10735

Closed
jamiedruce opened this issue Nov 16, 2023 · 0 comments · Fixed by #10739
Closed

Generic Analytics, event names throw warning #10735

jamiedruce opened this issue Nov 16, 2023 · 0 comments · Fixed by #10739
Assignees

Comments

@jamiedruce
Copy link

Type of issue

Bug

Description

As per the docs, for the generic analytics adapter, event names are used as the property name in the events object like so:

pbjs.enableAnalytics({
    provider: 'generic',
    options: { events: { bidRequested(request) {} } }
})

Where bidRequested is the event name. However, this throws the warning "WARNING: Generic analytics: options.events.bidRequested does not match any known Prebid event".

Looking at line 51 of genericAnalyticsAdapter.js its looking to validate events against the constants declared using CONSTANTS.EVENTS.hasOwnProperty(event)

This would only pass the conditional check if we entered the constant name and not the event name (BID_REQUESTED vs bidRequested).

Unsure if this is a code bug or a documentation bug (or if I'm doing something wrong here).

Steps to reproduce

  1. Add the generic analytics module config as per the docs
  2. Enable debugging messages
  3. Look in the console for the warning mentioned above

Test page

https://jsfiddle.net/2v8p47wm/1/

Expected results

To get no error, and for event names to be used as event properties.

Actual results

Console warning of invalid event

Platform details

Chrome 118.0, MacOS 14.0, PreBid.js 8.23.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants