{"id":4124,"date":"2010-10-02T17:23:52","date_gmt":"2010-10-02T17:23:52","guid":{"rendered":"http:\/\/www.mrbluesummers.com\/?p=4124"},"modified":"2011-04-06T15:07:45","modified_gmt":"2011-04-06T15:07:45","slug":"set-adsense-channels-by-browser-referrer-etc","status":"publish","type":"post","link":"http:\/\/www.mrbluesummers.com\/4124\/3d-tutorials\/set-adsense-channels-by-browser-referrer-etc","title":{"rendered":"Set AdSense Channels by Browser, Referrer, etc."},"content":{"rendered":"

Ever wondered how you can set channels in your Google AdSense ad units based on on-the-spot data like user browser or origin? In this quick tutorial I’ll be showing you how to set AdSense channels in order to track statistics based on user browser types, how they arrived at your site, and pretty much anything else. \u00a0It all pivots on the google_ad_channel parameter. \u00a0For those of you who are extra savvy, here’s a summary:<\/p>\n

    \n
  1. Build an AdSense ad unit using native code<\/a>,<\/li>\n
  2. Create AdSense channels for your parameters<\/a>,<\/li>\n
  3. Write JavaScript code to detect the value you need to use<\/a>,<\/li>\n
  4. Use the google_ad_channel<\/span> parameter to track stats on the right channel.<\/a><\/li>\n<\/ol>\n

    Build an AdSense Ad Unit With Native Code<\/h2>\n
    \"Creating<\/a><\/p>\n

    Creating an AdSense Unit is Easy. Channel setup can be tricky.<\/p>\n<\/div>\n

    Consider the following ad code which would form a regular 300×250.<\/p>\n

    <<\/span>script type=<\/span>\"<\/span>text\/javascript<\/span>\"<\/span>><\/span><<\/span>!<\/span>-<\/span>-<\/span>\r\ngoogle_ad_client =<\/span> \"<\/span>ca-pub-xxxxxxxxxxxx1083<\/span>\"<\/span>;<\/span>\r\n\/* Testing 300x250 - Do not target *\/<\/span>\r\ngoogle_ad_slot =<\/span> \"<\/span>1168546099<\/span>\"<\/span>;<\/span>\r\ngoogle_ad_width =<\/span> 300<\/span>;<\/span>\r\ngoogle_ad_height =<\/span> 250<\/span>;<\/span>\r\n\/\/--><\/span>\r\n<<\/span>\/<\/span>script><\/span>\r\n<<\/span>script type=<\/span>\"<\/span>text\/javascript<\/span>\"<\/span>\r\nsrc=<\/span>\"<\/span>http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js<\/span>\"<\/span>><\/span>\r\n<<\/span>\/<\/span>script><\/span><\/pre>\n

    When you create an ad unit, you’re given a chance to create and assign channels to it. Normally, these channels are going to be set values that are true no matter what. For example, “Medium-Rectangle”, “Above-The-Fold”, and “Articles-Section-Sidebar”. What you can’t seem to set are conditional parameters like “User-Came-From-Google” or “User-On-Firefox”.
    \n