AdWords
3.7K members online now
3.7K 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

Custom filed value for var google_conversion_value

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I am wanting to not pass a fixed amount ($450) through the conversion. I've tried adapting the code with the value field from our cart manufacturer <%=Session("g_TotalAmount")%>

 

I've tried variations of

var google_conversion_value = g_TotalAmount
var google_conversion_value = '<%=Session("g_TotalAmount")%>'
var google_conversion_value = "g_TotalAmount"
var google_conversion_value = "<%=Session("g_TotalAmount")%>"

but nothing seems to pass the value.

 

Here is the conversion code from Adwords (I've removed the ID and replaced with "MY_ID"):

 

<!-- Google Code for Roommaster Sales Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = MY_ID;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "YNrwCJSm2m0Q1uOx7AM";
var google_conversion_value = 450;
var google_conversion_currency = "USD";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="https://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="https://www.googleadservices.com/pagead/conversion/MY_ID/?value=450.00&amp;currency_code=USD&amp;label=YNr...>
</div>
</noscript>

I added the "https:" in the paths because I was getting "no http response" message in tag assistant before that.

Thanks, Kristi

1 Expert replyverified_user

Custom filed value for var google_conversion_value

Rising Star
# 2
Rising Star

Hi Kristi,

 

Are you asking how to pass dynamic values - value of each conversion based on actual purchase price?

Sumanth Sridhar

Re: Custom filed value for var google_conversion_value

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Yes, I am. Our reservation system had provided the pass-through var label of 

<%=Session("g_TotalAmount")%>

and I am not sure how to integrate this with the standard conversion code which now contains "450" as the

var google_conversion_value

 

Custom filed value for var google_conversion_value

Rising Star
# 4
Rising Star

Thank you page source code needs to be altered to accomodate the dynamic order value and it depends on how the page is coded. Are you using a standard platform like magento or volusion or a custom coded one?

Sumanth Sridhar

Re: Custom filed value for var google_conversion_value

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Thank you for your responses, Sumanth. I am not getting alerts of posts, so I'll see if I can figure out again how to subscribe to this thread.

I cannot change page source code other than adding an html chunk or javascript code embed. I am using the javascript option and input the adwords tracking code found in my initial post. I've tried editing the line that current sends a fixed transaction cost of $450 to insert the var name they have specified 

<%=Session("g_TotalAmount")%>

for var google_conversion_value.

 

Google analytics, which runs off of a separate google file they allow changes to (but it affects all asp pages, not just the PrintConfirmation, where I am inserting the conversion code) is tracking the actual transaction amount.  That script is below should that help. I do not want the conversion code mated with this code as the conversion does not take place until the PrintConfirmation.asp is fired:

 

This is separate from the code above from Adwords Conversion. I've removed our UA number for this post.

<script type="text/javascript">

// Include Google Tracking Script
// NOTE: GOOGLE ECOMMERCE is not updated Real-Time and could take up to an hour!

try{
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-OUR CODE']);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_setAllowAnchor', true]); 
  _gaq.push(['_trackPageview']);
  
  if ("<%=Session("PrintConfirmation")%>" == "YES") {
  
  _gaq.push(['_addTrans',
    '<%=Session("g_Order")%>',
    '<%=Session("g_Name")%>',
    '<%=Session("g_TotalAmount")%>', 	// NOTE! Change to g_TotalAmountInc to include VAT
    '0.00',  			      	// NOTE! Use g_TotalTax if you wish for tax to appear
    '0.00',
    '<%=Session("strCity")%>',
    '<%=Session("strState")%>',
    '<%=Session("strCountry")%>'
  ]);
  
  _gaq.push(['_addItem',
    '<%=Session("g_Order")%>',
    '<%=Session("g_RoomType")%>',
    'Room',
    '<%=Session("g_RoomDesc")%>',
    '<%=Session("g_RoomAmount")%>', // NOTE! Change to g_RoomAmountInc to include VAT
    '1'
  ]);

 if ("<%=Session("g_OptionsAmount")%>" != "0.00") {
	  _gaq.push(['_addItem',
	 '<%=Session("g_Order")%>',
	 'CART',
	 'Shopping Cart',
	 'Shopping Cart',
	 '<%=Session("g_OptionsAmount")%>', // NOTE! Change to g_OptionsAmountInc to include VAT
	 '1'
	]);    
  } ;
 
 _gaq.push(['_trackTrans']);
	  
  } ; 

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src=('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
 
} catch(err) {}  

</script>

Custom filed value for var google_conversion_value

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

Pushing the "subscribe RSS feed" on this thread loads a full page of html code. I'll check back. Thanks again.

Custom filed value for var google_conversion_value

Rising Star
# 7
Rising Star

Couple of things to note: AdWords & GA are different tracking mechanisms and wouldn't affect each other if installed on the same page. Setting up AdWords dynamic conversion value requires changes (depends how the value is passed) to the source code.

 

 

Alternatively, you can just import GA conversions into AdWords. This will ensure AdWords has conversion data and doesn't require any code changes. Here's how to do it.

 

Hope that helps, feel free to write back!

Sumanth Sridhar

Re: Custom filed value for var google_conversion_value

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭

Thank you again for your reply, Sumanth. I DO want to implement Adwords conversion tracking on my PrintConfirmation.asp page using either an html or javascript script embed.

 

Please advise only how to change the line

 

var google_conversion_value = 450

to a proper integration of the value of the transaction. I don't want to soley use GA, as I want to track ad retargeting campaigns.

 

I just found another thread which indicates this would work:

<!-- Google Code for Roommaster Sales Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = MYNUMBER;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "MYLABEL";
if (<%=Session("g_TotalAmount")%>) {
		var google_conversion_value = <%=Session("g_TotalAmount")%>;
		var google_conversion_currency = <%= currency %>;
	}
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="https://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="https://www.googleadservices.com/pagead/conversion/MYNUMBER/?value=<%=Session("g_TotalAmount")%>&amp;currency_code=<%=currency %>&amp;labelMYLABEL&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

 

 

Custom filed value for var google_conversion_value

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

Sumanth, Do you agree that the code in Response No. 8 is correct?

Custom filed value for var google_conversion_value

Rising Star
# 10
Rising Star

Hi Kristi,

 

Yes, that should work. I'd recommend implementing it and placing a test order. Be sure to install Google Tag Assistant to check if the tag loads properly upon successful check out.

 

Best,

Sumanth Sridhar