segment-integrations / analytics.js-integration-facebook-pixel

The Facebook Pixel analytics.js integration. https://segment.com/docs/integrations/facebook-pixel
MIT License
8 stars 16 forks source link

Add/advanced matching #20

Closed wcjohnson11 closed 8 years ago

wcjohnson11 commented 8 years ago

This PR adds support for Facebook Advanced Pixel Matching. https://developers.facebook.com/docs/facebook-pixel/pixel-with-ads/conversion-tracking#advanced_match

On initialize, we check for a user's traits that have been cached by A.js and fill in any matching attributes that are recognized by Facebook.

I removed the explicit overwriting of window.fbq on every page load so that it would be easier to test and because their snippet returns the existing fbq on initialization if window.fbq is already defined. I tested this and saw the pixels firing.

wcjohnson11 commented 8 years ago

These same IE9 errors are failing on Master as well. image Circle Master Test Circle Branch Test

corresponding to the following blocks https://github.com/segment-integrations/analytics.js-integration-facebook-pixel/blob/master/test/index.test.js#L69 https://github.com/segment-integrations/analytics.js-integration-facebook-pixel/blob/master/test/index.test.js#L80-L82

wcjohnson11 commented 8 years ago

This line is where the error is occuring. https://github.com/segment-integrations/analytics.js-integration-facebook-pixel/blob/master/lib/index.js#L43

wcjohnson11 commented 8 years ago

This is being caused in IE9 by a change in the process shim browserify puts in. @tsholmes is working on a fix that will get these tests to pass.

wcjohnson11 commented 8 years ago

@ndhoule @hankim813 @tsholmes

Could you guys take a look at this PR?