flom Posted November 18, 2005 Share Posted November 18, 2005 1) furthermore when adding the code of your contrib i found out that it is exactly the same code as i added to my STS-template for google analytics for every site. you also mentioned it in your install notes. hope i didn't misunderstand it... so i guess i do not have to add it to checkout_success.php as well, right? 2) my id is xxxxxx-x instead of xxxx-x - can that be correct? Quote Link to comment Share on other sites More sharing options...
flom Posted November 18, 2005 Share Posted November 18, 2005 sorry i have to disturb again :) 3) i added the include-code but when making an order and looking at the source code there is no passage with a <form> above the </body> tag. can u please tell me y? Quote Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2005 Share Posted November 18, 2005 (edited) Hello, I am not able to provide exhaustive support for the Google Analytics or AdWords services as I am not part of it (talking about difference between "conversion target" and "conversion tracking"). However that contrib will cover only the Analytics service part as the code is used only by that service. 1. Yes. You right. If you added the general tracking code into your STS there is no reason to add it again into the checkout_success.php page as long as you don't have <head> </head> tags anymore in that page. Please NOTE we talk only about the regular tracking code. The include analytics.php still have to be added at the bottom of checkout_success.php 2. This should be ok. After Google made the exmple code (xxxx-x) thay had many more users and their ID numbers goes bigger having more digits. Regards, Clement Edited November 18, 2005 by osCoders Quote Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2005 Share Posted November 18, 2005 This doesn't suppose to happen if the code is there. It is possible that your browser is loading the page from its cache. Please close the browser window and open a new one and try it again. Quote Link to comment Share on other sites More sharing options...
fatbloke Posted November 18, 2005 Share Posted November 18, 2005 Hi I want to add the new Google Analytics code to my pages - hopefully to track every cart page - the instructions are Copy the following code block into every webpage you want to track. Click in the box below to select all code. Next, copy it. Then, paste the code segment after the <head>, <meta> tags and before the </head> tag on each page you are planning to track. The code is <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "xxxxxxxx"; urchinTracker(); </script> What file do I add this code to ? I tried /catalog/index.php but that does not show the code in view source on product pages Thanks Roy Quote Link to comment Share on other sites More sharing options...
redrum Posted November 18, 2005 Share Posted November 18, 2005 (edited) What file do I add this code to ? I tried /catalog/index.php but that does not show the code in view source on product pages Thanks Roy If you want to track your whole site, simply add the code to the other pages as well. Just like you did with index.php, add the code between <HEAD> and </HEAD> in product_info.php, products_new.php etc. etc. // Fredrik Edited November 18, 2005 by redrum Quote Link to comment Share on other sites More sharing options...
mondos Posted November 18, 2005 Share Posted November 18, 2005 Hi osCoders, What about the <body onLoad="java script:__utmSetTrans()"> that it is said to be placed in the checkout_success.php page? It is said here: http://www.google.com/support/analytics/bi...7203&topic=2957 Thanx mondos Quote Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2005 Share Posted November 18, 2005 Hello David,Doesn't matter if your catalog is SSL or not. The code must be placed between < head > and < / head > tags which are not into the header.php file. If you use at least 1 SSL page (like the checkout ones are) my personal advice is to set-up your store as https:// ... into the Google profile. and use the https version of the tracking code over all your store. If you use the opposite way (the http:// tracking code into the https pages of your store) you will have a security pop-up warning each time you access the ssl pages. Regards, Clement Clement, Thank you for the contribution. It saved me much time over figuring it out for myself. As for the SSL versus non-SSL function I use the following code on each page I want tracked: <?php if ($request_type == 'SSL') { ?> <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct="UA-UA-XXXXXX-X"; urchinTracker(); </script> <? } else { ?> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct="UA-XXXXXX-X"; urchinTracker(); </script> <? } ?> (Obviously - I replaced XXXXXX-X in the above with my own account data). I found the code above in the following forum post (thanks to rrodkey): http://www.oscommerce.com/forums/index.php?s=&...ndpost&p=740465 Using the code above secure or non-secure server usage is auto-detected and the correct snippet is placed in the generated page - regardless of whether the pages uses https:// or http:// - a one-code-fits-all solution. I do not get any warnings concerning SSL / non-SSL mixed page content nor do I receive any other warnings or have any other problems. Currently I am using a shared SSL certificate provided by my host; I can think of no reason the code wouldn't work with a properly configured dedicated SSL certificate as well. Good results were present today in my Google Analytics - the code above is definately working fine for me. Just thought I would pass the information along... Thanks again. BFCase Quote Link to comment Share on other sites More sharing options...
zman818 Posted November 18, 2005 Share Posted November 18, 2005 Thanks for the contribution. Just a couple comments... The analytics.php versions for ssl/non-ssl are identical. It would probably make sense to distribute one copy only, in order to avoid confusion and facilitate editing/updating in the future. Additionally, you could use the SSL/Non-SSL conditional logic already included throughout much of osCommerce to eliminate the need for two checkout_success versions as well. Your placement of the urchin.js reference outside of the HEAD section is incorrect. Google directs users to place the urchin.js script reference within the HEAD section. (<script> tags should only appear within the HEAD or BODY sections. Placing them anywhere else is technically invalid). Your approach might work today, but might not tomorrow. Quote Link to comment Share on other sites More sharing options...
zman818 Posted November 18, 2005 Share Posted November 18, 2005 (edited) For example... <?php // set in app_top //$request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL'; if ($request_type == 'SSL') { ?> <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"> <?php } else { ?> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> <?php } ?> </script> <script type="text/javascript"> _uacct = "UA-xxxx-x"; urchinTracker(); </script> Edited November 18, 2005 by zman818 Quote Link to comment Share on other sites More sharing options...
EarnMore Posted November 18, 2005 Share Posted November 18, 2005 On the checkout_success page I am not seeing any info on the order such as the id or order total after the process is completed. I should be able to see all the info when I view the source.. right? Thanks.. Lyle Quote Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2005 Share Posted November 18, 2005 Hi osCoders, What about the <body onLoad="java script:__utmSetTrans()"> that it is said to be placed in the checkout_success.php page? It is said here: http://www.google.com/support/analytics/bi...7203&topic=2957 Thanx mondos Hello Mondos, Yes. You're right The onLoad command should be included into the <Body tag. This was missed by me when I transfered the contribution from our custom stores to the standard MS2. Thank you very much for telling us. I'll update the contribution in the next hour. Clement, Thank you for the contribution. It saved me much time over figuring it out for myself. As for the SSL versus non-SSL function I use the following code on each page I want tracked: <?php if ($request_type == 'SSL') { ?> <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct="UA-UA-XXXXXX-X"; urchinTracker(); </script> <? } else { ?> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct="UA-XXXXXX-X"; urchinTracker(); </script> <? } ?> (Obviously - I replaced XXXXXX-X in the above with my own account data). I found the code above in the following forum post (thanks to rrodkey): http://www.oscommerce.com/forums/index.php?s=&...ndpost&p=740465 Using the code above secure or non-secure server usage is auto-detected and the correct snippet is placed in the generated page - regardless of whether the pages uses https:// or http:// - a one-code-fits-all solution. I do not get any warnings concerning SSL / non-SSL mixed page content nor do I receive any other warnings or have any other problems. Currently I am using a shared SSL certificate provided by my host; I can think of no reason the code wouldn't work with a properly configured dedicated SSL certificate as well. Good results were present today in my Google Analytics - the code above is definately working fine for me. Just thought I would pass the information along... Thanks again. BFCase Hello Brian, Thank you for your suggestion. It is a very good one. I was just unsure if Google will track the non-ssl pages using the non-ssl tracking if the profile url is set to https:// or vice-versa. As you know, Google is asking for the http or https on each url. Anyway, if you say everything is ok and good tracking info are returned then it is time to integrate it. I'll add it into the next release (in about 1 hour). Thank you again for your suggestion. Thanks for the contribution. Just a couple comments...The analytics.php versions for ssl/non-ssl are identical. It would probably make sense to distribute one copy only, in order to avoid confusion and facilitate editing/updating in the future. Additionally, you could use the SSL/Non-SSL conditional logic already included throughout much of osCommerce to eliminate the need for two checkout_success versions as well. Your placement of the urchin.js reference outside of the HEAD section is incorrect. Google directs users to place the urchin.js script reference within the HEAD section. (<script> tags should only appear within the HEAD or BODY sections. Placing them anywhere else is technically invalid). Your approach might work today, but might not tomorrow. Hello Mike, The reason I used 2 different files for ssl and non-ssl instead of explanations was to avoid any confusion :) It seams my way not the best one. Now, with the suggestions and information about the conditional logic the confusion will be out. You are right about the position of the tracking code. It should be between the head tags. It was placed in the wrong place because of some kind of hurry. This will be fixed into the next release. Thank you very much for suggestions!!! Best regards, Clement Hello Lyle, Yes you should see somethink like: <form style="display:none;" name="utmform"> <textarea id="utmtrans">UTM:T|34535|Main Store|143.05|3.05|10.00|San Diego|CA|USA UTM:I|34535|XF-1024|Urchin T-Shirt|Shirts|10.00|9 UTM:I|34535|CU-3424|Urchin Drink Holder|Accessories|20.00|2 </textarea> </form> Please note that the contribution will be updated in about 1 hour. Anyway, the fixes (you should insert anyway into your store) are not the cause of your problems. Best regards, Clement Quote Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2005 Share Posted November 18, 2005 The updated version of the contribution is uploaded now. http://www.oscommerce.com/community/contributions,3756 Thank you all for sharing your sugestions. Best regards, Clement Quote Link to comment Share on other sites More sharing options...
redrum Posted November 18, 2005 Share Posted November 18, 2005 Hello Fredrik, The final price the contribution send to Google is the grand total of the order which means it contain any tax you applied. Isn't in that way on your store? Actually you're right. What I meant to ask you was if I can show the product/products price include tax. Sorry for that. When I check the source code i see this <textarea id="utmtrans">UTM:T|99999||137.00|7.80|60.00|City||Sweden UTM:I|99999|481|Item|Category|31.20|1</textarea> The final price include shipping is include tax (137.00) But the product price is whitout tax (31.20) Thanks, Fredrik Quote Link to comment Share on other sites More sharing options...
ActiveTuning Posted November 18, 2005 Share Posted November 18, 2005 Just to verify...the SSL version of the code is supposed to have two UA-UA in the account ID? <?php <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct="UA-UA-XXXXXX-X"; urchinTracker(); </script> Quote Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2005 Share Posted November 18, 2005 Hello David. No. Just one UA like the non-ssl version . I'll change it into the contribution package right away. Thank you, Clement Quote Link to comment Share on other sites More sharing options...
jbr39117 Posted November 18, 2005 Share Posted November 18, 2005 Clement, As of now I am still having difficulty... I still cannot view the utm form in the source code on the checkout_success.php page. Does the fact that I use STS have anything to do with it? First I tried it without creating a template (everything went into the checkout_success.php page), then I created a template and put the tracking code and "onLoad="java script:__utmSetTrans()" into it which didnt work either. Is there something I am missing here? Quote Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2005 Share Posted November 18, 2005 Just to verify...the SSL version of the code is supposed to have two UA-UA in the account ID? <?php <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct="UA-UA-XXXXXX-X"; urchinTracker(); </script> David, That was my copy and paste error in my preceding post when i munged my number to be XXXXXX-X - sorry. I went back to edit my original post but that function is not there for some reason. I hope people see this update... BFCase Quote Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2005 Share Posted November 18, 2005 Clement, As of now I am still having difficulty... I still cannot view the utm form in the source code on the checkout_success.php page. Does the fact that I use STS have anything to do with it? First I tried it without creating a template (everything went into the checkout_success.php page), then I created a template and put the tracking code and "onLoad="java script:__utmSetTrans()" into it which didnt work either. Is there something I am missing here? Please try to make any html change into your checkout_success template as test (add some text or change some dimensions) and see if that changes are reflected into the source code. Quote Link to comment Share on other sites More sharing options...
EarnMore Posted November 18, 2005 Share Posted November 18, 2005 I have STS also and had a hard time getting this to work also. I had to put into the middle of the page as below... <script language="JavaScript"> <?php // osCoders.biz - Analystics - start include(DIR_WS_MODULES . 'analytics/analytics.php'); // osCoders.biz - Analistics - end ?> </script> Also... when you try to add the: <?php // osCoders.biz - Analystics - start /* Conditional code added thank to rrodkey and bfcase IMPORTANT -- IMPORTANT - IMPORTANT You'll need to update the "xxxx-x" in the samples (twice) above with your own Google Analytics account and profile number. To find this number you can access your personalized tracking code in its entirety by clicking Check Status in the Analytics Settings page of your Analytics account. */ if ($request_type == 'SSL') { ?> <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-xxxxxx-x"; urchinTracker(); </script> <?php } else { ?> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-xxxxx-x"; urchinTracker(); </script> <? } // osCoders.biz - Analistics - end ?> the STS template will not process it because of the PHP. You have to pick one or the other. Quote Link to comment Share on other sites More sharing options...
jbr39117 Posted November 18, 2005 Share Posted November 18, 2005 Clement, Yes, the template reflects all the changes that I make to it. As of now, the template contains both the urchin tracking code (ssl version - the conditional does not work for sts) and the onLoad="java script:__utmSetTrans()" code which are both showing in the source code when viewed, but that is all it is showing. The utm form is not showing up. Does the analytics/analytics.php command need to be placed differently in the checkout_success.php file when using sts? -Jared I have STS also and had a hard time getting this to work also. I had to put into the middle of the page as below... <script language="JavaScript"> <?php // osCoders.biz - Analystics - start include(DIR_WS_MODULES . 'analytics/analytics.php'); // osCoders.biz - Analistics - end ?> </script> Lyle, has this worked for you? Wouldnt that need to go before the </head> tag in the checkout_success.php file? Quote Link to comment Share on other sites More sharing options...
radders Posted November 18, 2005 Share Posted November 18, 2005 Now I see the reason this has to be between the <HEAD> tags. It is because of the <body onLoad> Has anyone managed to get this working with Greg's Paypal Shopping Cart IPN? Everything is in classes and there is no checkout_success.php. The nearest equivalent seems to be one of the functions in includes /modules/payment/paypal/classess/osC Quote Link to comment Share on other sites More sharing options...
BearHappy Posted November 19, 2005 Share Posted November 19, 2005 I was able to get the Analytics basic to work with my STS install. Add the below code to your catalog\includes\sts_display_output.php After: // Load up the <head> content that we need to link up everything correctly. Append to anything that may have been set in sts_user_code.php $template['headcontent'] .= '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '">' . "\n"; $template['headcontent'] .= $sts_block['headertags']; $template['headcontent'] .= '<base href="' . (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . '">' . "\n"; Insert: if ($request_type == 'SSL') { $template['headcontent'] .= '<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">' . "\n"; $template['headcontent'] .= '</script>' . "\n"; $template['headcontent'] .= '<script type="text/javascript">' . "\n"; $template['headcontent'] .= '_uacct="UA-xxxxxx-x";' . "\n"; $template['headcontent'] .= 'urchinTracker();' . "\n"; $template['headcontent'] .= '</script>' . "\n"; } else { $template['headcontent'] .= '<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">' . "\n"; $template['headcontent'] .= '</script>' . "\n"; $template['headcontent'] .= '<script type="text/javascript">' . "\n"; $template['headcontent'] .= '_uacct="UA-xxxxxx-x";' . "\n"; $template['headcontent'] .= 'urchinTracker();' . "\n"; $template['headcontent'] .= '</script>' . "\n"; } Hope this helps... :thumbsup: Quote Link to comment Share on other sites More sharing options...
redrum Posted November 19, 2005 Share Posted November 19, 2005 There is a typo in the contrib that cause a javascript error. To fix this change onLoad="java script:__utmSetTrans()" to onLoad="javascript:__utmSetTrans()" that resides inside the body-tag in checkout_confirmation.php // Fredrik Quote Link to comment Share on other sites More sharing options...
tedmcdonald Posted November 19, 2005 Share Posted November 19, 2005 Clement, thanks for this contribution. :thumbsup: I have a question: My catalog is non-ssl while shopping. When you login and checkout, the customer enters SSL, but it is a different domain. E.g. Person shops at http://shop.com, and checks out at https://secure-shop.com. When I set up my Analytics account, which domain name do I use? Both? Does it matter? Thanks for your help. Best, Ted Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.