Doug Fir
Doug Fir

Reputation: 21242

What do I do with 'amp;' or '&'?

(Not sure exactly how to tag this question, any suggestions please let me know, went with just html tag for now)

I have been given a pixel to place on our website. It's just an img tag with a src attribute like this:

 src="//www.googleadservices.com/pagead/conversion/123456789/?value=1.00&currency_code=USD&label=abcdefg1234&guid=ON&script=0"/

What are '& a m p ;'? Do (added spaces between characters since SO formats as just '&') I need to modify to be like so:

src="//www.googleadservices.com/pagead/conversion/123456789/?value=1.00&currency_code=USD&label=abcdefg1234&guid=ON&script=0"/

Upvotes: 0

Views: 2038

Answers (3)

stackoverflow
stackoverflow

Reputation: 78

You can check this in your HTML.

  == a space in HTML

& &

&lt; <

&gt; >

&quot; "

&apos; '

& or &amp; connect two or more paramters in a request url. Means and

Upvotes: 1

Ouroborus
Ouroborus

Reputation: 16875

It's not just SO that formats &amp; like that, it's all web sites as this is a feature of HTML. They're called "entities" and consist of a sequence of characters beginning with an ampersand and ending with a semicolon. They're a way of describing a character in situations where using the literal character is undesirable. You can find out more about them here.

In the case of your pixel code, they aren't needed (as you discovered) as URLs use a different means of encoding strange characters. It's likely that ill-informed copy and pasting is the culprit for their existence in that URL.

Upvotes: 1

recursive
recursive

Reputation: 86094

If you need your instances of &amp; to be just &, then you can just take out the amp; part.

Incidentally, &amp; is the HTML character entity that represents the "&" character.

Upvotes: 1

Related Questions