Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions integrations/facebook-pixel/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var FacebookPixel = (module.exports = integration('Facebook Pixel')
.option('standardEventsCustomProperties', [])
.option('keyForExternalId', '')
.option('userIdAsExternalId', false)
.option('limitedDataUse', true)
.mapping('standardEvents')
.mapping('legacyEvents')
.mapping('contentTypes')
Expand Down Expand Up @@ -102,6 +103,9 @@ FacebookPixel.prototype.initialize = function() {
if (!this.options.automaticConfiguration) {
window.fbq('set', 'autoConfig', false, this.options.pixelId);
}
if (this.options.limitedDataUse) {
window.fbq('dataProcessingOptions', ['LDU'], 0, 0);
}
if (this.options.initWithExistingTraits) {
var traits = this.formatTraits(this.analytics);
window.fbq('init', this.options.pixelId, traits);
Expand Down
7 changes: 7 additions & 0 deletions integrations/facebook-pixel/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('Facebook Pixel', function() {
pixelId: '123123123',
agent: 'test',
initWithExistingTraits: false,
limitedDataUse: true,
whitelistPiiProperties: [],
blacklistPiiProperties: [],
standardEventsCustomProperties: []
Expand Down Expand Up @@ -147,6 +148,12 @@ describe('Facebook Pixel', function() {
);
});

it('should call dataProcessingOptions if limitedDataUse is enabled', function() {
analytics.stub(window, 'fbq');
analytics.initialize();
analytics.called(window.fbq, 'dataProcessingOptions', ['LDU'], 0, 0);
});

before(function() {
options.initWithExistingTraits = true;
});
Expand Down