nican VIP
Total posts: 392
10 Mar 2016 09:07

Hello, I am trying to setup Google Adwords conversions tracking code

since my subscription value may change due to discounts I'd like to implement the possibility to track the exact value of each conversion

question:

what is the PHP expression that displays the conversion value in Emerald? For example: <?php echo $totalValue ?>, <? echo totalValue ?>

Thank you


For setting this up I am referring to this google support article

and the specific explanation is this:

To add conversion tracking code to PHP pages using your web page editor, refer to the code below, then remove from your own code the lines that are crossed out and manually add the areas that are highlighted. If you're tracking button or link clicks as conversions instead of page loads, then the changes to your code will be slightly different. See these instructions for tracking clicks as conversions for more information.

<!-- 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 = "xxx-XXx1xXXX123X1xX";
var google_conversion_value = 10;
if (<? echo $totalValue ?>) {
    var google_conversion_value = <? echo $totalValue ?>
    var google_conversion_currency = <? echo $currency ?>
}
var google_conversion_currency = "USD";
/* ]]> */ 
</script>
<script type="text/javascript"
src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<img height=1 width=1 border=0
src="//www.googleadservices.com/pagead/
conversion/1234567890/?value=
<? echo $totalValue ?>&conversion_currency=<? echo $currency ?>
&label=Purchase&script=0">
</noscript>
</body>

Open your conversion confirmation page PHP file. If multiple pages are generated from the same file, find the section in the PHP file which generates your conversion page. If your site has a variable conversion value, determine the PHP expression that displays that value. For example: , Choose the "Purchase/Sale" conversion category while going through the conversion tracking setup. Enter a default numeric value in the "Conversion value" field, then replace the line var google_conversion_value = … manually with the following:

if (<%= totalValue %) {
    var google_conversion_value = <%= totalValue %>;
}

You'll also need to replace the default numeric value with <%= totalValue%> in the <noscript> section of the tag highlighted above. (Optional) If you accept different currencies, add a line within the if statement to accept currency: var google_conversion_currency = <? echo $currency ?>

In the noscript section of the tag, make sure that you add &currency_code=<? echo $currency ?> Copy and save the resulting code snippet. Insert the conversion tracking code on to the conversion confirmation page. Make sure that the code appears within a static HTML section, not contained within a PHP code section (delineated by <? and ?> markers). As you insert the code snippet, make sure that you place it directly into the body of the conversion confirmation page. To make sure that you do, search for the tag and place the code immediately above it. If the </body> tag isn't located within the static portion of the HTML page, make sure that you add the code snippet so that it appears within the <body> section of the page as shown below.

Save your conversion confirmation file and upload to your web server if necessary. If you'd like to test the placement of your conversion tracking code, go to your conversion page by completing a conversion on your website. In your web browser, view the source of the web page (in most browsers, right-click on the page and select View source). You should see the conversion tracking code between the <body> and </body> tags on your page. The PHP expression will be replaced by the actual conversion value when you view the source.

Last Modified: 15 Mar 2016


Sergey
Total posts: 13,748
14 Mar 2016 02:39

It is all much simplier. There is HTML parameter in JS action now. You can insert entire snippet there. Also for next version I added the same placeholders there like it is in description. So just use.

<script type="text/javascript">
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 = "xxx-XXx1xXXX123X1xX";
var google_conversion_value = 10;
var google_conversion_value = [PRICE]
var google_conversion_currency = "USD";
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"></script>
<noscript>
<img height=1 width=1 border=0 src="//www.googleadservices.com/pagead/conversion/1234567890/?value=[PRICE]&conversion_currency=USD&label=Purchase&script=0">
</noscript>

nican VIP
Total posts: 392
14 Mar 2016 13:02

Sergey It is all much simplier. There is HTML parameter in JS action now. You can insert entire snippet there. Also for next version I added the same placeholders there like it is in description

Thank you!


Sergey
Total posts: 13,748
15 Mar 2016 13:46

Works?

Powered by Cobalt