Forum Moderators: buckworks & skibum

Message Too Old, No Replies

Conversion Tracking Code Question

Optional variable doesn't seem to be working

         

TradeMark

4:26 am on Dec 8, 2004 (gmt 0)

10+ Year Member



Greetings all,

I have a php-based cart and recently added the basic conversion tracking for my adwords campaigns. It has successfully registered conversions.

I want to start getting more detailed info so I deployed the customized conversion tracking tag. The code looks like this on my confirmation page:

<!-- Google Conversion Code -->
<script language="JavaScript">
<!--
google_conversion_id = #*$!#*$!#*$!xxxx;
google_conversion_language = "en_US";
google_conversion_format = "1";
google_conversion_color = "FFEECA";
if ($order_id) {
google_conversion_value = $order_id;
}
google_conversion_label = "Purchase";
</script>
<script language="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/xxxxxxxxxxxxx/?value=$order_id&label=Purchase&script=0">
</noscript>

(I replaced the conversion id with "xxxx's".)

$order_id is dynamically generated on the page and I verified through an 'echo' that it does contain the correct value when the page renders.

When I viewed the page source after testing a conversion, $order_id does not show as the variable but rather as the name of the variable "$order_id". I would think that $order_id would show as 1555, for example.

I ran the test by just purchasing and not by clicking through an adword campaign. Can that be the reason that the variable is not being filled with the correct value?

Any thoughts are appreciated.

TM

jatar_k

5:11 pm on Dec 8, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if that is a php variable then it will need to be echo'ed properly into the javascript

google_conversion_value = $order_id;

should probably be

google_conversion_value = <?php echo $order_id?>;

AdWordsAdvisor

5:35 pm on Dec 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey TradeMark, I've consulted with a Conversion Tracking contact here, who tells me that jatar_k nailed it.

I ran the test by just purchasing and not by clicking through an adword campaign. Can that be the reason that the variable is not being filled with the correct value?

The answer to this question is 'No', but it's worth noting that we'll only record a conversion if you have clicked on the ad within the last 30 days. However, this does not otherwise directly effect whether we track the transaction value or not. And jatar_k's info should take care of that.

AWA

TradeMark

9:16 pm on Dec 8, 2004 (gmt 0)

10+ Year Member



Thanks jatar_k and AdWordsAdvisor for your quick replies. I'll add the echo statement tonight and test it out.

TradeMark

TradeMark

7:17 pm on Dec 15, 2004 (gmt 0)

10+ Year Member



Here's the latest...

I modified the code on my php-based confirmation page as follows:

<!-- Google Conversion Code -->
<!-- Google Conversion Code -->
<script language="JavaScript">
<!--
google_conversion_id = #*$!xxx;
google_conversion_language = "en_US";
google_conversion_format = "1";
google_conversion_color = "FFEECA";
if (<?php echo $order_id;?>) {
google_conversion_value = <?php echo $order_id;?>
}
google_conversion_label = "Purchase";
-->
</script>
<script language="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/xxxxxx?value=<?php echo $order_id;?>&label=Purchase&script=0">
</noscript>

I tested and the "<?php echo $order_id;?>" code operates correctly with the order number getting filled in in all three places in the code. I've also gotten several Adwords conversions since modifying and testing the code. I run all iterations of "custom reports" with every checkbox checked, yet I can't see any evidence that the order_id is being captured in the conversion. Where should I see this in the reports?

Thanks for your assistance.

TradeMark

[edited by: eWhisper at 12:35 pm (utc) on Dec. 16, 2004]
[edit reason] Removed Account ID # [/edit]