The objective of this script is to show visitors who found my site by clicking on one of our Google Adwords a specific telephone number (in graphic form) for the sake of tracking.
Here is the code I have been working on. My issue lies within the document.URL area of the script. I tried this code without declaring the source variable, but the script would redirect me to the document.URL declaration.
After running this code on a test page, it now displays the first image in the series, but should be showing the second image as the page I am viewing it on does not have the URL tied to it.
<script language = “javascript” type=”text/javascript”>
Expand|Select|Wrap|Line Numbers
- function adWords()
- {
- source=document.URL <!-- If I eliminate this declaration and just use document.URL in the IF statement, the page gets redirected to that URL
- if(source="http://www.appletreeanswers.com/index.html") {
- document.write("<IMG SRC='/normalimage.jpg'>")
- }else{
- document.write("<IMG SRC='/adwordimage.jpg'>")
- }
- }
</script>
<script language="javascript" type="text/javascript">
adWords();
</script>
Thanks!