2019-06-18

Concept:


1. Use Google Tage Generator to generate GPT tags automatically

2. What is "AdSense"


Code:


1. loads the GPT library used by Ad Manager

2. googletag.cmd.push(function() {

            googletag.sizeMapping()      // map the ad sizes to browser size

                    .addSize([ ], [ ])      // brwoser sieze, ad size                

            googletag.defineSlot("", ,"")

                    .defineSizeMapping()         // to implement the mapping           

                    .addService(googletag.pubads())    

                    .setTargeting('', ])                                

                               required parameter: 

                                                    1. netqork code  / targeted ad unit                                                                       

                .setCollapseEmptyDiv

        googletag.pubads().enableSingleRequest();     //improve page's performance

       googletag.pubads().addEventListener()       // listener will be called when pubads service renders                                                                                 a slot

你可能感兴趣的:(2019-06-18)