AdWords
3.2K members online now
3.2K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me
star_border
Reply

How to use dynamic conversion value

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

I try to use a conversion value of {order_total}/6.

My tracking code :

<!-- Google Code for Track purchase Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 868736224;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "Ag4xCNnyn2wQ4LmfngM";
if ({order_total}){
var google_conversion_value = ({order_total}/6);
}
var google_conversion_currency = "GBP";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/868736224/?value={order_total}/6&amp;currency_code=GBP&am...>
</div>
</noscript>

It works well in the script tag but i put it in the noscript i have an error (see pictures : https://framapic.org/gallery#8IuhDVe2vcxs/CpCmcLmAagJz.JPG) , how can i do?

Kinds regards.

1 Expert replyverified_user

How to use dynamic conversion value

Top Contributor
# 2
Top Contributor

Hi Mike H,

 

You're right, that won't work because no math is done in the link. You'll need to do something like this:

 

<!-- Google Code for Track purchase Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 868736224;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "Ag4xCNnyn2wQ4LmfngM";
if ({order_total}){
var google_conversion_value = ({order_total}/6);
}
var google_conversion_currency = "GBP";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/868736224/?value="+({order_total}/6) + "&amp;currency_cod...>"
</div>
</noscript>

 

Note: parenthesis ({order_total}/6) are for clarity of the code, not required.

You might be able to do it this way, no guarantees:

<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/868736224/?value={order_total/6}&amp;currency_code=GBP&am...>"

 

Best of Luck!

 

Pete

 

petebardo -- Deadhead doing AdWords

Re: How to use dynamic conversion value

[ Edited ]
Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hello petebardo,

 

Thanks for the reply.

 

I tried the 2 solutions and i have the error : Dynamic conversion value in wrong format in the <noscript> tag.

https://framapic.org/gallery#6akas2c6X5Uc/hJo8SrCCIXCB.jpg

 

Can it works good whitout noscript, because on my site they can't buy whitout js?

 

Regards.

 

How to use dynamic conversion value

Top Contributor
# 4
Top Contributor

Hi mike h,

 

You're right, I don't know what I was thinking. The first example won't work because that requires javascript. That leaves us with a server-side calculation. That's this one:

<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/868736224/?value={order_total/6}&amp;currency_code=GBP&am...>"

 

This is producing a value with more than 2 decimal places, and that's most likely what it's complaining about. How to resolve this depends on the language of your shopping cart. Basically, you'll need to round the calculated value to 2 places.

 

If it's php, python or asp, {round(order_total/6,2)}.

It will look something like this:

<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/868736224/?value={round(order_total/6,2)}&amp;currency_code=GBP&am...>"

 

Put a test order through. When you get to this page, look at the code. This, {round(order_total/6,2)}, should have been replaced by a value that is your order total divide by 6 and rounded to 2 places. If that's what you see, it should be all set to go.

 

Best of Luck!

 

Pete

 

 

petebardo -- Deadhead doing AdWords

Re: How to use dynamic conversion value

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hello,

 

That won't work. I speak with a guy who say me I can't do it in the noscript, but can it work good whitout noscript?

 

Regards.

How to use dynamic conversion value

Top Contributor
# 6
Top Contributor

Hi mike h,

 

Did you try it? What happened? What shopping cart software you use? What scripting/programming language is it in?

 

If you leave out the noscript part, visitors with Javascript disabled won't be tracked. If a visitor can't buy without js, it should make no difference but will still report as an error in tag manager.

 

Pete

 

petebardo -- Deadhead doing AdWords