Tuesday, December 11, 2012

Auto Add ValueTrack Params To All Destination URLs

Today we have a script that will help make sure all of your keywords are tagged with the appropriate ValueTrack parameters.  You can use this to ensure that all of your tracking params are added correctly to your urls.

You can add your own query string parameters to the mapping at the top of the script.  For example, if all the keywords in your account need to have the parameter "channel=sem" in their destination url, you could add that to the URL_PARAMS_TO_ADD mapping at the top of the file and it will be added to all your urls.

Also, I updated the script to allow you to add whatever values you want from the account into the url. See the examples for adding Campaign and AdGroup names to the url if you like.


* Auto Add ValueTrack (and other) Params If Not There
* Created By: Russ Savage
* Version 1.1
* ChangeLog v1.1
*  - Added the ability to add function calls into the parameters to add
* FreeAdWordsScripts.com
function main() {
  var URL_PARAMS_TO_ADD = { 
    "kw" : "{keyword}",
    "crid" : "{creative}",
    "mt" : "{matchtype}",
    "ntwk" : "{network}",
    "ap" : "{adposition}",
    "dv" : "{device}",
    "dvm" : "{devicemodel}",
    //"camp" : getCampaignName,  <----- This function is defined below
    //"ag" : getAdGroupName  <----- and so is this one
  var kw_iter = AdWordsApp.keywords()
                  .withCondition("DestinationUrl != ''")
  while(kw_iter.hasNext()) {
    var kw = kw_iter.next();
    var destUrl = kw.getDestinationUrl();
    if(!destUrl || destUrl === '') { continue; }
    var toAppend = [];
    for(var key in URL_PARAMS_TO_ADD) {
      if(destUrl.indexOf(key) >= 0) { continue; }
      var value = URL_PARAMS_TO_ADD[key];
      //check to see if we should call a function
      if(typeof(value) === 'function') {
        value = encodeURI(value(kw));
    if(destUrl.indexOf('?') >= 0) {
      kw.setDestinationUrl(destUrl + "&"+toAppend.join('&'));
    } else {
      kw.setDestinationUrl(destUrl + "?"+toAppend.join('&'));

// As long as the function call is passed a kw object, you can insert
// whatever value you want into the url
function getCampaignName(kw) {
  return kw.getCampaign().getName();

function getAdGroupName(kw) {
  return kw.getAdGroup().getName();


  1. Have a look at this tips https://resume-chief.com/blog/resume-writing-tips. I know that programmers don't like to write resumes.

  2. Are you having issues when it comes to getting programming assignments drafted? IdealAssignmentHelp is here to cover all your programming assignments without any kind of glitches at all. Yes, you can get connected to their Business Assignment Help team and make it easy for yourself to submit the respective paper within the given deadline and that too matching with the university stated instructions.

  3. Many of the ValueTrack parameters map to fields in AdWords API reports, however not necessarily with identical text value then why not Try and check us here

  4. Aluminum projecting is believed to be a piece of another person's recreation or leisure activity in excess of a modern reason that it holds. Indeed, Aluminum profile supplier in china even a craftsman or a stone worker participates in aluminum projecting

  5. Additionally contains amazing cell which is found in the strip and squeeze of pomegranate. Moringa Seeds Cake Supplier Furthermore, its standard utilization keeps

  6. Thanks a lot for your comment 🙂 have a great day!
    cable extruder manufacturer

  7. Numerous individuals purchase bike parts from the neighborhood store and try not to trust that the firsts will originate from the makers processing plant. Automotive motorcycle parts manufacturer

  8. where the softened plastic would be filled a pass on. Mould Tool Making Manufacturer The bite the dust would be looking like the item that will be made. The liquid would be filled the bite the dust and to cool under pressure.

  9. Any individual who works in, or possesses a food and drink administration activity, knows the significance of refrigeration frameworks and hardware. external rotor manufacturer

  10. Quickbooks is the advanced accounting software to handle small and medium sized business. The software has many premium features to enhance your business.
    Quickbooks File Restore

  11. Smooth and skin fitting when you wear trimmed tops yet you can likewise select to wear free bottoms like long skirts and sweetheart cut loose pants. Bikini Swimsuits for Women

  12. Quickbooks Repair Tool is the combination of all tools which are used to diagnose common issues in Quickbooks. If you found any issues like installation errors, performance errors, printing errors, and login errors, you can download this tool to fix all problems.

  13. Here're some top of the line Street Light Case accessible out there - with pressure Die projecting body and high conveyance safety glass the body of this Led. street light Supplier

  14. Firmware File contains your operating system in its original form as you bought it. If you are facing any issues in your smartphones like a software issue, dead issues, and IMEI issue, you can download flash files to resolve all the issues. stock rom for yuphoria

  15. The Quickbooks Install Diagnostic tool is a fixation software that is significantly structured to diagnose and fix the problems that the user would possibly face whereas putting in the QuickBooks software package. It’s an exclusive installation fixation companion that consolidates several powerful installation breakdown options which will demolish all the bugs and issues.

    Numerous errors and issues can be fixed with this tool. A few common and popular errors have been listed here. Let’s have a look at them.
    1. QuickBooks update error 15270
    2. QuickBooks update error 15223
    3. QuickBooks update error 1328
    4. QuickBooks update error 12007
    So, if you want to Quickbooks install diagnostic tool exe Download just follow the link.

  16. Good blog. Keep sharing. I love them Are you also searching for Cheap assignment writers? we are the best solution for you. We are best known for delivering nursing writing services to students without having to break the bank

  17. Your blogs are great. Are you also searching for Help with my Math assignment? we are the best solution for you. We are best known for delivering quality essay writing services to students without having to break the bankv

  18. I’m really happy to say it was an interesting post to read. I learned new information from your article, you are doing a great job. What’s up, I’m Jakob. I’m a web developer living in Texas. I am a fan of technology, design, and web development. I’m also interested in writing and movies. This website (central.bitdefender.com ) is only a guide for users to understand the process to Download, Install and Activate Bitdefender Products. for more information visit our website central.bitdefender.com.

  19. It really ads value in the auto add, nice strategy you are using.
    b cup size bra

  20. Your blog was interesting and helpful. Thank you for sharing your ideas, and please keep them coming!
    profile creation sites