I am using a JavaScript that reads the URL and parses the parameters. The JavaScript works just fine when I add a document.write to the body of the page. I am trying to take a parameter value and populate it into a Google JavaScript for ad serving. It would be ideal to take the parameter 'fire' from the 'frank' variable and replace it with 'VALUE' located in this JS: GA_googleAddAttr("ad_key", "VALUE");.
I feel as though I am missing something taking the result from the first JS and making it available for placement in the Google JS.
Any help will be greatly appreciated. Thank in advance.
Example URL: http://www.example.com/test.html?frank=fire
------------ JavaScript: get url parameter ------------
<script type="text/javascript">
function gup( name ){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ) return "";
else return results[1];}
var frank_param = gup( 'frank' );
</script>
------------ JavaScript: google ad serving attribute ------------
<script type="text/javascript">
GA_googleAddAttr("ad_key", "VALUE");
</script>
ad_key = Added within the Google DFP ad serving platform
VALUE = Used for targeting ads for a specific page