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

Custom dimensions data initial changes #784

Open
wants to merge 32 commits into
base: nightly
Choose a base branch
from

Conversation

pm-priyanka-deshmane
Copy link
Collaborator

Type of change

  • Feature

Description of change

Reading and passing the custom dimension data in logger call and GAM call.
Below function will be added to profile

(function() {   
  var owpbjs = window.owpbjs || {};
  var cdsData = isFunction(window.getCustomDimensionsDataFromPublisher) ? window.getCustomDimensionsDataFromPublisher() : null;
  owpbjs.onEvent('auctionInit', function(args) {
    if(cdsData){
      owpbjs.setConfig({  
        cds:cdsData.cds
      });
    }
  });
 
  function isFunction(functionToCheck) {  
    return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]';    
  }
})()

Other information

Publisher will call the getCustomDimensionsDataFromPublisher function from page.

<script type='text/javascript'>	
	window.getCustomDimensionsDataFromPublisher = function(){
		return {
		  cds: {
			traffic: {
				value: "email",
				sendtoGAM: true
			},
			author: {
				value: "henry",
				sendtoGAM: false
			},
			key3: {
				value: "noGam"
			}
		}
	   }
	}
</script>

@@ -621,6 +657,8 @@ function auctionInitHandler(args) {
cacheEntry.origAdUnits = args.adUnits;
cacheEntry.referer = args.bidderRequests[0].refererInfo.topmostLocation;
cache.auctions[args.auctionId] = cacheEntry;
let cdsData = getCDSDataGAMStr();
!isEmptyStr(cdsData) && window.googletag.pubads().setTargeting('cds', cdsData);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add conditional check for googletag

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