options_page

The Google URL Builder options page function.

Description

options_page(); 

Usage

  1. if ( !function_exists( 'options_page' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-url-builder/urlbuilder.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = options_page(); 
  7.  

Defined (2)

The function is defined in the following location(s).

/urlbuilder.php  
  1. function options_page() { 
  2. ob_start(); ?> 
  3.  
  4. <div class="wrap"> 
  5. <h2>Google URL Builder</h2> 
  6.  
  7. <div class="postbox-container" style="width:75%;"> 
  8.  
  9. <p>This plugin help you add custom campaign parameters to your URLs and pass the information to Google Analytics. If you want to add Google Analytics (at the moment just the Universal Analytics tracking available) to your WordPress blog, and then I advice you to see the <a href="http://wordpress.org/extend/plugins/google-universal-analytics/" target="_blank">Google Universal Analytics</a>.</p> 
  10.  
  11. <form name="ctm" onsubmit="createURL(); return false;"> 
  12. <table border="0" cellpadding="0" cellspacing="0" > 
  13. <p>Tag your online marketing campaigns and receive customized data to your Google Analytics account. Fill in the form information and click the <strong>Submit</strong> button.</p> 
  14.  
  15. <p><strong>Step 1</strong>: Enter the URL of your website.</p> 
  16.  
  17.  
  18. <table class="outline" border="0" cellpadding="0" cellspacing="5"> 
  19. <tbody><tr> 
  20. <td width="25%" valign="top" nowrap="nowrap"><strong>Website URL</strong>: <span class="required">*</span></td> 
  21. <td width="70%" valign="top" nowrap="nowrap"><input name="website" size="50" type="text"><br /><code> (e.g. <em>http://www.onlineads.lt/services/</em>)</code></td> 
  22. <td width="5%" valign="top" nowrap="nowrap"><input name="utm_id" type="hidden" size="1" maxlength="1"></td> 
  23. </tr> 
  24. </tbody> 
  25. </table></p> 
  26.  
  27. <p><span class="stitle"><strong>Step 2</strong>: Fill in the fields below. <strong>Campaign Source</strong>, <strong>Campaign Medium</strong> and <strong>Campaign Name</strong> should always be used. </span> 
  28.  
  29. <table class="outline" border="0" cellpadding="0" cellspacing="5" > 
  30. <tbody><tr><td nowrap="nowrap" width="25%"><strong>Campaign Source</strong>: <span class="required">*</span></td> 
  31. <td nowrap="nowrap" width="75%"><input name="utm_source" size="25" type="text"> (referrer: google, onlineads, newsletter-september)</td> 
  32. </tr><tr><td><strong>Campaign Medium</strong>: <span class="required">*</span></td> 
  33. <td><input name="utm_medium" size="25" type="text"> (marketing medium: cpc, banner, email)</td> 
  34. </tr><tr><td><strong>Campaign Term</strong>: </td><td><input name="utm_term" size="25" type="text"> (identify the paid keywords)</td> 
  35. </tr><tr><td><strong>Campaign Content</strong>: </td><td><input name="utm_content" size="25" type="text"> (use to differentiate ads)</td> 
  36. </tr><tr><td><strong>Campaign Name</strong>: <span class="required">*</span></td> 
  37. <td><input name="utm_campaign" size="25" type="text"> (product, promotional code, or slogan</td><td></td></tr></tbody></table></p> 
  38.  
  39. <p><strong>Step 3</strong>: Click <strong>Submit</strong> to tag your URL, and then click <strong>Clear</strong> to tag a new URL.</p><br> 
  40.  
  41. <input name="result" size="70" class="result" type="text" > 
  42.  
  43. <br><br> 
  44.  
  45. <input value="Generate URL" onclick="createURL();" type="submit" class="button-primary"> 
  46. <input class="button-secondary" value="Clear" onClick="clearURL();" type="button"> 
  47.  
  48. </form> 
  49.  
  50. </br></br> 
  51.  
  52. <strong>Pro Tip:</strong> For periodic campaign performance tracking and reporting use <a href="https://nexusad.com/?utm_source=wordpress&utm_medium=Google%2BURL%2BBuilder%2B1.0.1&utm_campaign=wp_plugins" title="nexusAd" target="_blank">nexusAd reporting tool</a>. 
  53.  
  54. <script language="javascript" type="text/javascript"> 
  55. function createURL() { 
  56. var form = document.ctm; 
  57. var myurl = "" 
  58. if (!form) { 
  59. return; 
  60. if (!form.website.value || form.website.value == "") { 
  61. alert("Required Website Missing!"); 
  62. form.website.focus(); 
  63. return -1; 
  64. if((!form.utm_id.value || form.utm_id.value == "") && 
  65. (!form.utm_source.value || form.utm_source.value == "") && 
  66. (!form.utm_medium.value || form.utm_medium.value == "")) { 
  67. alert("Required ID Missing!"); 
  68. form.utm_id.focus(); 
  69. return -1; 
  70. if (!form.utm_id.value || form.utm_id.value == "") { 
  71. if (!form.utm_source.value || form.utm_source.value == "") { 
  72. alert("Required Source Missing!"); 
  73. form.utm_source.focus(); 
  74. return -1; 
  75. if (!form.utm_medium.value || form.utm_medium.value == "") { 
  76. alert("Required Medium Missing!"); 
  77. form.utm_medium.focus(); 
  78. return -1; 
  79. if (!form.utm_campaign.value || form.utm_campaign.value == "") { 
  80. alert("Required Campaign Missing!"); 
  81. form.utm_campaign.focus(); 
  82. return -1; 
  83. if (form.website.value && form.website.value != "") { 
  84. if (form.website.value.indexOf("http") != 0) { 
  85. form.website.value = "http://"+form.website.value; 
  86. if (form.website.value.indexOf("/", 9) < 0 && form.website.value.indexOf("?") == -1 ) { 
  87. form.website.value += "/"; 
  88. if (form.website.value.indexOf("/", 9) > -1 && form.website.value.indexOf("?") == -1 ) { 
  89. myurl += form.website.value+"?"; 
  90. } else { 
  91. myurl += form.website.value+"&"; 
  92. if (form.utm_id.value && form.utm_id.value != "") { 
  93. myurl += "utm_id="+removeSpaces(form.utm_id.value); 
  94. if (form.utm_source.value && form.utm_source.value != "") { 
  95. if (form.utm_id.value && form.utm_id.value != "") 
  96. myurl += "&"; 
  97. myurl += "utm_source="+removeSpaces(form.utm_source.value); 
  98. if (form.utm_medium.value && form.utm_medium.value != "") { 
  99. myurl += "&utm_medium="+removeSpaces(form.utm_medium.value); 
  100. if (form.utm_term.value && form.utm_term.value != "") { 
  101. myurl +="&utm_term="+removeSpaces(form.utm_term.value); 
  102. if (form.utm_content.value && form.utm_content.value !="") { 
  103. myurl +="&utm_content="+removeSpaces(form.utm_content.value); 
  104. if (form.utm_campaign.value && form.utm_campaign.value != "") { 
  105. myurl += "&utm_campaign="+removeSpaces(form.utm_campaign.value); 
  106. form.result.value = myurl; 
  107. return 0; 
  108. function clearURL() { 
  109. var form = document.ctm; 
  110. if (!form) { 
  111. return; 
  112. form.website.value = ""; 
  113. form.utm_id.value = ""; 
  114. form.utm_source.value = ""; 
  115. form.utm_medium.value = ""; 
  116. form.utm_campaign.value = ""; 
  117. form.utm_content.value = ""; 
  118. form.utm_term.value = ""; 
  119. form.result.value = ""; 
  120. return 0; 
  121. function removeSpaces(value) { 
  122. if(value.indexOf(' ')>0) { 
  123. value = value.split(' ').join('+'); 
  124. return encodeURIComponent(value); 
  125. </script> 
  126.  
  127. </div> 
  128.  
  129. <?php 
  130.  
  131. echo ob_get_clean(); 
  1. function options_page() { 
  2. ob_start(); ?> 
  3.  
  4. <div class="wrap"> 
  5. <h2>Google URL Builder</h2> 
  6.  
  7. <div class="postbox-container" style="width:75%;"> 
  8.  
  9. <p>This plugin help you add custom campaign parameters to your URLs and pass the information to Google Analytics. If you want to add Google Analytics (at the moment just the Universal Analytics tracking available) to your WordPress blog, and then I advice you to see the <a href="http://wordpress.org/extend/plugins/google-universal-analytics/" target="_blank">Google Universal Analytics</a>.</p> 
  10.  
  11. <form name="ctm" onsubmit="createURL(); return false;"> 
  12. <table border="0" cellpadding="0" cellspacing="0" > 
  13. <p>Tag your online marketing campaigns and receive customized data to your Google Analytics account. Fill in the form information and click the <strong>Submit</strong> button.</p> 
  14.  
  15. <p><strong>Step 1</strong>: Enter the URL of your website.</p> 
  16.  
  17.  
  18. <table class="outline" border="0" cellpadding="0" cellspacing="5"> 
  19. <tbody><tr> 
  20. <td width="25%" valign="top" nowrap="nowrap"><strong>Website URL</strong>: <span class="required">*</span></td> 
  21. <td width="70%" valign="top" nowrap="nowrap"><input name="website" size="50" type="text"><br /><code> (e.g. <em>http://www.onlineads.lt/services/</em>)</code></td> 
  22. <td width="5%" valign="top" nowrap="nowrap"><input name="utm_id" type="hidden" size="1" maxlength="1"></td> 
  23. </tr> 
  24. </tbody> 
  25. </table></p> 
  26.  
  27. <p><span class="stitle"><strong>Step 2</strong>: Fill in the fields below. <strong>Campaign Source</strong>, <strong>Campaign Medium</strong> and <strong>Campaign Name</strong> should always be used. </span> 
  28.  
  29. <table class="outline" border="0" cellpadding="0" cellspacing="5" > 
  30. <tbody><tr><td nowrap="nowrap" width="25%"><strong>Campaign Source</strong>: <span class="required">*</span></td> 
  31. <td nowrap="nowrap" width="75%"><input name="utm_source" size="25" type="text"> (referrer: google, onlineads, newsletter-september)</td> 
  32. </tr><tr><td><strong>Campaign Medium</strong>: <span class="required">*</span></td> 
  33. <td><input name="utm_medium" size="25" type="text"> (marketing medium: cpc, banner, email)</td> 
  34. </tr><tr><td><strong>Campaign Term</strong>: </td><td><input name="utm_term" size="25" type="text"> (identify the paid keywords)</td> 
  35. </tr><tr><td><strong>Campaign Content</strong>: </td><td><input name="utm_content" size="25" type="text"> (use to differentiate ads)</td> 
  36. </tr><tr><td><strong>Campaign Name</strong>: <span class="required">*</span></td> 
  37. <td><input name="utm_campaign" size="25" type="text"> (product, promotional code, or slogan</td><td></td></tr></tbody></table></p> 
  38.  
  39. <p><strong>Step 3</strong>: Click <strong>Submit</strong> to tag your URL, and then click <strong>Clear</strong> to tag a new URL.</p><br> 
  40.  
  41. <input name="result" size="70" class="result" type="text" > 
  42.  
  43. <br><br> 
  44.  
  45. <input value="Generate URL" onclick="createURL();" type="submit" class="button-primary"> 
  46. <input class="button-secondary" value="Clear" onClick="clearURL();" type="button"> 
  47.  
  48. </form> 
  49.  
  50. </br></br> 
  51.  
  52. <strong>Pro Tip:</strong> For periodic campaign performance tracking and reporting use <a href="https://nexusad.com/?utm_source=wordpress&utm_medium=Google%2BURL%2BBuilder%2B1.0.1&utm_campaign=wp_plugins" title="nexusAd" target="_blank">nexusAd reporting tool</a>. 
  53.  
  54. <script language="javascript" type="text/javascript"> 
  55. function createURL() { 
  56. var form = document.ctm; 
  57. var myurl = "" 
  58. if (!form) { 
  59. return; 
  60. if (!form.website.value || form.website.value == "") { 
  61. alert("Required Website Missing!"); 
  62. form.website.focus(); 
  63. return -1; 
  64. if((!form.utm_id.value || form.utm_id.value == "") && 
  65. (!form.utm_source.value || form.utm_source.value == "") && 
  66. (!form.utm_medium.value || form.utm_medium.value == "")) { 
  67. alert("Required ID Missing!"); 
  68. form.utm_id.focus(); 
  69. return -1; 
  70. if (!form.utm_id.value || form.utm_id.value == "") { 
  71. if (!form.utm_source.value || form.utm_source.value == "") { 
  72. alert("Required Source Missing!"); 
  73. form.utm_source.focus(); 
  74. return -1; 
  75. if (!form.utm_medium.value || form.utm_medium.value == "") { 
  76. alert("Required Medium Missing!"); 
  77. form.utm_medium.focus(); 
  78. return -1; 
  79. if (!form.utm_campaign.value || form.utm_campaign.value == "") { 
  80. alert("Required Campaign Missing!"); 
  81. form.utm_campaign.focus(); 
  82. return -1; 
  83. if (form.website.value && form.website.value != "") { 
  84. if (form.website.value.indexOf("http") != 0) { 
  85. form.website.value = "http://"+form.website.value; 
  86. if (form.website.value.indexOf("/", 9) < 0 && form.website.value.indexOf("?") == -1 ) { 
  87. form.website.value += "/"; 
  88. if (form.website.value.indexOf("/", 9) > -1 && form.website.value.indexOf("?") == -1 ) { 
  89. myurl += form.website.value+"?"; 
  90. } else { 
  91. myurl += form.website.value+"&"; 
  92. if (form.utm_id.value && form.utm_id.value != "") { 
  93. myurl += "utm_id="+removeSpaces(form.utm_id.value); 
  94. if (form.utm_source.value && form.utm_source.value != "") { 
  95. if (form.utm_id.value && form.utm_id.value != "") 
  96. myurl += "&"; 
  97. myurl += "utm_source="+removeSpaces(form.utm_source.value); 
  98. if (form.utm_medium.value && form.utm_medium.value != "") { 
  99. myurl += "&utm_medium="+removeSpaces(form.utm_medium.value); 
  100. if (form.utm_term.value && form.utm_term.value != "") { 
  101. myurl +="&utm_term="+removeSpaces(form.utm_term.value); 
  102. if (form.utm_content.value && form.utm_content.value !="") { 
  103. myurl +="&utm_content="+removeSpaces(form.utm_content.value); 
  104. if (form.utm_campaign.value && form.utm_campaign.value != "") { 
  105. myurl += "&utm_campaign="+removeSpaces(form.utm_campaign.value); 
  106. form.result.value = myurl; 
  107. return 0; 
  108. function clearURL() { 
  109. var form = document.ctm; 
  110. if (!form) { 
  111. return; 
  112. form.website.value = ""; 
  113. form.utm_id.value = ""; 
  114. form.utm_source.value = ""; 
  115. form.utm_medium.value = ""; 
  116. form.utm_campaign.value = ""; 
  117. form.utm_content.value = ""; 
  118. form.utm_term.value = ""; 
  119. form.result.value = ""; 
  120. return 0; 
  121. function removeSpaces(value) { 
  122. if(value.indexOf(' ')>0) { 
  123. value = value.split(' ').join('+'); 
  124. return encodeURIComponent(value); 
  125. </script> 
  126.  
  127. </div> 
  128.  
  129. <?php 
  130.  
  131. echo ob_get_clean();