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

Converion Tracking with basket value

Follower ✭ ✭ ☆
# 1
Follower ✭ ✭ ☆

I want my conversion tracking to use the shopping basket value for conversion value. I run php scripts and my basket variable is $SUBTOTAL. I have tried using the code which is provided but it doesn't work. How do I do this?

2 Expert replyverified_user

Re: Converion Tracking with basket value

Collaborator ✭ ☆ ☆
# 2
Collaborator ✭ ☆ ☆

Hi

Are you using this code

Spoiler
<!-- Google Code for Purchase Conversion Page -->
  <script type="text/javascript">
  /* <![CDATA[ */
  var google_conversion_id = 1234567890;
  var google_conversion_language = "en_US";
  var google_conversion_format = "1";
  var google_conversion_color = "666666";
  var google_conversion_label = "Purchase";
  if (<? echo $SUBTOTAL?>) {
  var google_conversion_value = <? echo $SUBTOTAL?>
  }
  /* ]]> */ 
  </script>
  <script type="text/javascript"
  src="http://www.googleadservices.com/pagead/conversion.js">
  </script>
  <noscript>
  <img height=1 width=1 border=0
  src="http://www.googleadservices.com/pagead/
  conversion/1234567890/?value=
  <? echo $SUBTOTAL ?>&label=Purchase&script=0">
  </noscript>

 

If yes, did you check in the source if the value use getting passed in the code or not? 

check with google tag assistant if code is firing properly or not. If you have tried all this then please post your code.

hope this helps

 

Regards, Nik
LinkedIn  |   @nikhilparachure | My Blog

Re: Converion Tracking with basket value

Follower ✭ ✭ ☆
# 3
Follower ✭ ✭ ☆

I just noticed I was missing the $SUBTOTAL on the bottom. Thanks for your help

Re: Converion Tracking with basket value

Follower ✭ ✭ ☆
# 4
Follower ✭ ✭ ☆

The tag assistant says: ERROR Dynamic conversion value wrong format

 

This is my code

 

<!-- Google Code for X4Labs Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1556508216;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "WUe-CLDI1gMQuLH43wM";
if (<? echo $SUBTOTAL?>) {
  var google_conversion_value = <? echo $SUBTOTAL?>
  }
  /* ]]> */
  </script>
  <script type="text/javascript"
  src="http://www.googleadservices.com/pagead/conversion.js">
  </script>
  <noscript>
  <img height=1 width=1 border=0
  src="http://www.googleadservices.com/pagead/
  conversion/1556508216/?value=
  <? echo $SUBTOTAL ?>&label=Purchase&script=0">
  </noscript>
<!-- End Google Code for X4Labs Conversion Page -->

Re: Converion Tracking with basket value

Collaborator ✭ ☆ ☆
# 5
Collaborator ✭ ☆ ☆

HI

When you check in the browser does $SUBTOTAL gets replaced by real number? Remember it has to be just number no $ or no other currency sign.

Regards

Nik

 

Regards, Nik
LinkedIn  |   @nikhilparachure | My Blog

Re: Converion Tracking with basket value

Follower ✭ ✭ ☆
# 6
Follower ✭ ✭ ☆

No it doesn't

Re: Converion Tracking with basket value

Collaborator ✭ ☆ ☆
# 7
Collaborator ✭ ☆ ☆

In the redered code if $SUBTOTAL is show just like that and not with the value of that variable then there is something wrong with the code. 

Make sure you have short tags on the web server as you are using <? instead of <?php

Regards

Nik

 

Regards, Nik
LinkedIn  |   @nikhilparachure | My Blog

Re: Converion Tracking with basket value

Top Contributor
# 8
Top Contributor

Or you could do it like this:

 

if (<?php echo $SUBTOTAL?>) {
  var google_conversion_value = <?php echo $SUBTOTAL?>
  }

 

 

On of the things possible with this script is if $SUBTOTAL is an empty string, the script will fail due to syntax errors, so I usually do it like this (note the extra single quotes):

 

if ('<?php echo $SUBTOTAL?>') {
  var google_conversion_value = '<?php echo $SUBTOTAL?>'
  }

 

Remember, and I'm sure you know this, variable names are case-sensitive in PHP, so be sure you have spelled it exactly as it appears elsewhere in the code.

 

Best of Luck!

 

Pete

petebardo -- Deadhead doing AdWords

Re: Converion Tracking with basket value

Follower ✭ ✭ ☆
# 9
Follower ✭ ✭ ☆

The tag assistant still says the same error. I tried if (<?php echo $SUBTOTAL?>) {
  var google_conversion_value = <?php echo $SUBTOTAL?>
  }

then the one with extra single quotes but still no luck?

Re: Converion Tracking with basket value

[ Edited ]
Top Contributor
# 10
Top Contributor

Hi bondimedical3, you said earlier you see $SUBTOTAL in the code rather than a value?

 

This does suggest PHP is not interpreting $SUBTOTAL.  Can you echo it out somewhere else to see what it's value is?

 

Jon

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits