X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   X-Payments issues & questions (https://forum.x-cart.com/forumdisplay.php?f=50)
-   -   X-Payments with Google Analytics Conversion Code (https://forum.x-cart.com/showthread.php?t=66792)

carpeperdiem 05-06-2013 07:46 PM

X-Payments with Google Analytics Conversion Code
 
Anyone using Google Analytics with conversion tracking and X-Payments?

I use AlteredCart CheckoutOne w/ XPC so it may be my mod, but...

I have discovered that *my* Google Analytics conversion code is NOT tracking when paid by credit card (x-payments). Now, it very well could be my AlteredCart mod.... but just in case it isn't:

Can someone please verify (yes it will require a test transaction)...

1. make sure your google analytics code is on and tracking ecommerce.
2. make an order, pay with credit card (x-payments)
3. when you get back to the success page:
/cart.php?mode=order_message&orderids=XXXXX
3. TURN ON webmaster mode (reload order_message page)
LOOK for variable:
{$ga_track_commerce}
it should be "Y" - but in my store, when paying by credit card, {$ga_track_commerce} is "N" ??????

If {$ga_track_commerce} is "N", all kinds of tracking data fails to send.

This has been a TOTAL PITA to troubleshoot this.
Is this my custom XPC code?

Anyone else wondering if their GA conversion tracking has not been working right?

carpeperdiem 05-08-2013 05:33 AM

Re: X-Payments with Google Analytics Conversion Code
 
This gets interesting...

Bill @ AlteredCart asked me to disable chekout_one and checkout with only stock OPC and x-payments.

I did a test order with C1 disabled.
And the order_message "success page" source contains all the GA code (and it reported to GA). That's good.
And the conversion code and sales data appears almost instantly in GA. That's good.

HOWEVER - this is now getting strange┘

If you look at the variables in the order_message page, the variable, {$ga_track_commerce} is set to "N" ???? yes, with only x-payments and OPC, the variable, {$ga_track_commerce} is set to "N"

But if {$ga_track_commerce} is N, then why/how are the 3 transaction variables showing, because in the template,

/skin/common_files/modules/Google_Analytics/ga_code_async.tpl

there is an if...

Code:

{if $config.Google_Analytics.ganalytics_e_commerce_analysis eq "Y"
 and $ga_track_commerce eq "Y"
 and $main eq "order_message"
 and $orders
}
 // Ecommerce Tracking for order_message page

etc┘

SO - if {$ga_track_commerce} is N, the tracking scripts shouldn't appear. Right?

BUT -- if I turn C1 off and use xcart OPC, $ga_track_commerce is N, but all tracking code is there.
AND -- if I turn C1 back on, $ga_track_commerce is also N, but all tracking code is missing.

Any ideas what's going on here?

Very confused.

carpeperdiem 05-08-2013 09:38 AM

Re: X-Payments with Google Analytics Conversion Code
 
OK. Now this is getting interesting.

Bill suggested looking at file,

/include/checkout_init.php

about line 506, you will see

Code:

$smarty->assign('ga_track_commerce', $ga_track_commerce);
$ga_track_commerce = 'N';


Hold on there!

IF $smarty->assign('ga_track_commerce', $ga_track_commerce); is supposed to take the setting from $ga_track_commerce and assign it to smarty, why is the very next line changing this back to 'N' regardless of the switch setting in the google analytics module?

Bill's suggestion was to force the switch to Y, and that does solve the issue -- x-payment credit card sales now have GA tracking code on order_message

Code:

//  next line commented out to force ga_track_commerce to Y
//  $smarty->assign('ga_track_commerce', $ga_track_commerce);
        $smarty->assign('ga_track_commerce', 'Y');
// next line changed from N to Y
// why is line in the code at all?
    $ga_track_commerce = 'Y';


Surely others must be missing their google analytics tracking if this switch is forced to N

Anyone know what's actually going on here?

PS -- with this edit, all sales now track to GA, all conversion code is present in order_message, as it's supposed to be.

carpeperdiem 05-09-2013 07:18 AM

Re: X-Payments with Google Analytics Conversion Code
 
I just got off the phone with a senior code guy from Google Adwords/Analytics (in India) and he thinks the x-cart code is a mess - but without knowing the reasons WHY the kludgy redundancies, he can't make suggestions to improve it.

He confirmed that the last round of edits that I made were working -- we did a bunch of test transactions starting with AdWords as well as organic search as well as just typing in my URL. We checked out with paypal and credit card. We confirmed that the brute-force edits that we made put the correct code into the order_message success page in all situations, and now, finally, my site is tracking correctly.

But using the stock GA code, especially since using x-payments, the tracking has not been working.

I URGE everyone using x-payments to triple check their GA tracking code and verify conversion tracking. You may be surprised at what you find.

If X-cart wants to know what I learned here, please ask, and I will share.

ambal 05-09-2013 11:20 PM

Re: X-Payments with Google Analytics Conversion Code
 
> If X-cart wants to know what I learned here, please ask, and I will share.

Yes, sure! I am puzzled with this issue myself, too.

DanUK 11-26-2014 07:26 AM

Re: X-Payments with Google Analytics Conversion Code
 
Glad I found this as I am tearing my hair out wondering why the asynch code is not outputting to the order message page on my 4.6.1 site using any method of payment. I too found that $ga_track_commerce is setting itself to N. I have altered the checkout_init.php to say 'Y' and it now works. was there an offoical reason for this or ane explanation?

DanUK 11-26-2014 08:05 AM

Re: X-Payments with Google Analytics Conversion Code
 
Actually asynch code is still not ouputting but 'traditional' now code is after the change - is asynch code meant to appear on the order_message page or is it hidden is some javascript somewhere?

ambal 12-22-2014 01:45 AM

Re: X-Payments with Google Analytics Conversion Code
 
I am stickying this thread.

MAPerformance Admin 12-26-2014 08:21 AM

Re: X-Payments with Google Analytics Conversion Code
 
I made the suggested change to the code and I'm still not seeing conversion data on the invoice page. Here is my changed code:

Code:

$smarty->assign('orders', $orders);
    //Commented out $smarty->assign('ga_track_commerce', $ga_track_commerce);
    $ga_track_commerce = 'Y'; //Change from 'N' to 'Y' based on http://forum.x-cart.com/showpost.php?p=357851&postcount=3 (12/22/2014)
   
    $smarty->assign("ga_async_commerce", $ga_async_commerce);
    $ga_async_commerce = "N";


I had tried changing the Async part to 'Y' as well but it did not help, and I changed it back because it wasn't mentioned here originally. Any other ideas?

MAPerformance Admin 12-29-2014 08:22 AM

Re: X-Payments with Google Analytics Conversion Code
 
Bump for a response. Qualiteam has nothing to offer at this time aside from linking to this thread. We need to get our Analytics in check... please help!

EDIT: Another issue we've run into is our post-purchase emails sent from Bazaarvoice to solicit reviews on items purchased have dropped dramatically since enabling X-Payments. I imagine it's similar to the Google Analytics issue. There seems to be something about XP purchases that is preventing conversion data from being passed to our code on the order confirmation page. Does our code have to be altered to work properly with XP, or is XP "broken" and causing the issues. Meaning, does the fix have to go inside XP code?


All times are GMT -8. The time now is 02:53 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.