Skip to content

Conversation

@longstoryshort
Copy link
Contributor

@longstoryshort longstoryshort commented Aug 12, 2021

What does this PR do?

This PR does the following:

  1. Updates beacon.js HTTP and HTTPS links to https://sb.scorecardresearch.com/cs/<c2 client Id value>/beacon.js. Requested changes document (see 1st rquest).
  2. Adds support of the consent label cs_ucfr: allows a customer to map page() event property to the _cs_ucfr_ label (comScore user consent flag) in the Destination Settings; converts property value into "1"/"0" as expected by comScore. PRD document.

Are there breaking changes in this PR?
No.

Testing
Testing completed successfully: both unit tests and local testing.

  1. Unit tests

Unit tests completed successfully including new (highlighted in orange) and changed (highlighted in red).

  1. Local testing

2.1 Consent flag is not mapped in the Destination Settings

Result: cs_ucfr is not passed with beacon.js

2.2 Consent flag is mapped in the Destination Settings, page() event does not contain specified property

Result: cs_ucfr is not passed with beacon.js

2.3 Consent flag is mapped in the Destination Settings, page() event property is other then 1/0, true/false

Result: cs_ucfr is passed with beacon.js, _cs_ucfr=""

2.4 Consent flag is mapped in the Destination Settings, page() event property is Null

Result: cs_ucfr is passed with beacon.js, cs_ucfr=""

2.5 Consent flag is mapped in the Destination Settings, page() event property is true (bool)

Result: cs_ucfr is passed with beacon.js, cs_ucfr="1"

2.6 Consent flag is mapped in the Destination Settings, page() event property is "true" (string)

Result: cs_ucfr is passed with beacon.js, cs_ucfr="1"

2.7 Consent flag is mapped in the Destination Settings, page() event property is 1 (int)

Result: cs_ucfr is passed with beacon.js, cs_ucfr="1"

2.8 Consent flag is mapped in the Destination Settings, page() event property is "1" (string)

Result: cs_ucfr is passed with beacon.js, cs_ucfr="1"

2.9 Consent flag is mapped in the Destination Settings, page() event property is false (bool)

Result: cs_ucfr is passed with beacon.js, cs_ucfr="0"

2.10 Consent flag is mapped in the Destination Settings, page() event property is "false" (string)

Result: cs_ucfr is passed with beacon.js, cs_ucfr="0"

2.11 Consent flag is mapped in the Destination Settings, page() event property is 0 (int)

Result: cs_ucfr is passed with beacon.js, cs_ucfr="0"

2.12 Consent flag is mapped in the Destination Settings, page() event property is "0" (string)

Result: cs_ucfr is passed with beacon.js, cs_ucfr="0"

Any background context you want to provide?
Both changes requested by Fox.

  • comScore representative confirmed we should be loading beacon.js via HTTPS only.
  • cs_ucfr flag was introduced by comScore last year and required for tracking user consent. This implementation follows PRD document here.

Is there parity with the server-side/android/iOS integration components (if applicable)?
Planned, but not ready yet.
iOS and Android implementation of the cs_ucfr flag is planned in the upcoming weeks.

Does this require a new integration setting? If so, please explain how the new setting works
Yes.
This change requires a new setting consentFlag. The setting is a string field, not required. The setting is live in the Staging environment.
The setting allows a customer to specify page() event property name which should be mapped to the cs_ucfr beacon.js label.
If the setting is not populated, or mapped property is missing in the page() call - the integration omits cs_ucfr label. If mapped property value is 1 or true - the integration sets cs_ucfr="1". If mapped property value is 0 or false - the integration sets cs_ucfr="0". If mapped property value is any value other than 1/0/true/false, or if it is Null - the integration sets cs_ucfr="".

Links to helpful docs and other external resources
PRD document: link

@longstoryshort longstoryshort marked this pull request as draft August 12, 2021 01:09
Copy link
Contributor

@kdaswani kdaswani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @longstoryshort! I really appreciate all the detail in the description and test results. I've left a couple of comments - one for Pooya (who we will also request review from) and one for you 😄

@pooyaj given Elena's thorough test results and only a few customers using Comscore (Fox, Nexstar), is pinning to a specific source necessary or could we go straight to adding this to a release train?

@kdaswani kdaswani requested a review from pooyaj August 12, 2021 02:56
@kdaswani kdaswani marked this pull request as ready for review August 12, 2021 02:56
Copy link
Contributor

@pooyaj pooyaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the auto-imported options the rest looks good to me.

@longstoryshort
Copy link
Contributor Author

longstoryshort commented Aug 25, 2021

@kdaswani As discussed with Fox - cs_ucfr flag mapping now supports properties and context attributes, nested objects and US Privacy string.

Changes / updates:

  • Properties and context objects support: The integration looks for the specified attribute in the properties{} object, if not found - checks context{} object.
  • Nested attributes support: a user can provide the path to the nested attribute, excluding the top-level object (for example: traits.prop, privacy.us_privacy)
  • US Privacy String support: map 3rd character from the US Privacy String to cs_ucfr values. "N" => cs_ucfr=1, "Y" => 0, "-" => cs_ucfr is omitted (CCPA not applicable per US Privacy String docs)
  • When mapped property is Null - cs_ucfr is omitted

Unit tests:
Unit tests completed successfully including new (highlighted in red):

Local tests:

Local tests completed successfully

  1. The integration looks for the attribute property in the properties{} first. If specified attribute is not found - maps context{} object.

Settings:

Result:

  1. The integration maps nested attribute in the properties{} object. Nested attribute must be specified without top level object.

Settings:

Result:

If nested attribute is not found in the properties{} -- look for it in the context{}:

  1. US Privacy String mapping:

4.1 3rd character = "N" => cs_ucfr = 1

4.2 3rd character = "Y" => cs_ucfr = 0

4.3 3rd character = "-" => cs_ucfr omitted

  1. Mapped property / context attribute = Null => cs_ucfr omitted

Copy link
Contributor

@kdaswani kdaswani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a couple of notes on two of the unit tests, but otherwise this looks great! Once we update those unit tests, this is all good from my end. @pooyaj can you do another review and let us know if there's a standard for whether if conditions should be single or multi-line? We had to make some updates as per Fox's request in terms of the mappings (i.e. can map from the context object, can map using the US Privacy string values). Thanks so much!

}
});

if (this.options.consentFlag) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pooyaj do we have a preference/standard on if we should put some of these conditions on a single line or if multiple lines are clearer?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the current format is fine

@kdaswani kdaswani requested a review from pooyaj August 25, 2021 03:37
Copy link
Contributor

@pooyaj pooyaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

}
});

if (this.options.consentFlag) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the current format is fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants