react-facebook-pixel icon indicating copy to clipboard operation
react-facebook-pixel copied to clipboard

Support options argument in tracking functions

Open asheba opened this issue 5 years ago • 9 comments

The fbq track function allows passing another JSON object argument with options - one of which, eventID, is used for deduplication with server-side reporting.

This is documented here: https://developers.facebook.com/docs/marketing-api/conversions-api/deduplicate-pixel-and-server-events

asheba avatar Aug 13 '20 16:08 asheba

@zsajjad Any chance to review + merge this one? It's just passing another argument 🙏

asheba avatar Aug 18 '20 08:08 asheba

@zsajjad I too would love to see this PR merged

claygorman avatar Sep 04 '20 16:09 claygorman

I sadly just removed this library because it didn't support passing the eventId for deduplication, eventually leading me to this thread/PR.

You should really add this, it's gamebreaking to be able to pass the eventId to prevent duplication.

martink-rsa avatar Nov 11 '20 11:11 martink-rsa

For the love of god, merge this commit plz

Vegeta-47 avatar Jan 29 '21 06:01 Vegeta-47

@martink-rsa did u use another package, how did u fix the issue ?

Vegeta-47 avatar Jan 29 '21 06:01 Vegeta-47

Hi @Vegeta-47 ,

I reverted to the manual way of setting it.


window.fbq("init", pixelId)
window.fbq("track", "PageView")

function fbPixel(f, b, e, v, n, t, s) {
  if (f.fbq) return
  n = f.fbq = function () {
    n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments)
  }
  if (!f._fbq) f._fbq = n
  n.push = n
  n.loaded = !0
  n.version = "2.0"
  n.queue = []
  t = b.createElement(e)
  t.async = !0
  t.src = v
  s = b.getElementsByTagName(e)[0]
  s.parentNode.insertBefore(t, s)
}

Later on I called it again with the id I needed to pass:

 window.fbq("track", "Purchase", { value, currency }, { eventID: token })

martink-rsa avatar Jan 29 '21 06:01 martink-rsa

Thanks for replying @martink-rsa, ill do the same

Vegeta-47 avatar Jan 29 '21 07:01 Vegeta-47

@zsajjad This was approved but never merged? Would you consider merging in and releasing pending PR's or sharing access to the repository so someone else can do it? I'd volunteer to help out if you are too busy.

We really need this third argument as de-duplication is really important these days. Another option would be spinning off a new package based on this one (our build platform is not accepting forks :/).

houmark avatar May 29 '21 08:05 houmark

Why has this not been merged?

danwetherald avatar Jun 29 '21 18:06 danwetherald