-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tracker] [TagManagerEnhancedEcommerce] Issues #1613
Comments
@Cruiser13 I just tested it - it works on my side: But it does not send any Google also does not propose an event property in purchase section: https://developers.google.com/tag-manager/enhanced-ecommerce#purchases |
To-Do Summary: Tracking IssuestrackCheckoutComplete
trackProduct
trackProductImpression
trackCartAdd
trackCartRemove
My Workaround: <?php
namespace AppBundle\Controller;
class CartController extends \CoreShop\Bundle\FrontendBundle\Controller\CartController
{
public function summaryAction(Request $request)
{
// @todo: remove this method after #1613 has been fixed
// @see: https://github.com/coreshop/CoreShop/issues/1613
$flashBag = $this->container->get('session')->getFlashBag();
$codeTracker = $this->get(CodeTracker::class);
if ($flashBag instanceof FlashBag && $flashBag->has('_tracking')) {
foreach ($flashBag->get('_tracking') as $bag) {
if (is_array($bag)) {
foreach ($bag as $block) {
$codeTracker->addCodePart($block);
}
}
}
}
return parent::summaryAction($request);
}
public function removeItemAction(Request $request)
{
// @todo: remove this method after #1613 has been fixed
// @see: https://github.com/coreshop/CoreShop/issues/1613
$cartItem = $this->get('coreshop.repository.cart_item')->find($request->get('cartItem'));
if ($cartItem instanceof CartItemInterface) {
$this->get('coreshop.tracking.manager')->trackCartRemove(
$this->getCart(),
$cartItem->getProduct(),
$cartItem->getQuantity()
);
$blocks = $this->get(CodeTracker::class)->getBlocks();
if (is_array($blocks) && count($blocks) > 0) {
$this->addFlash('_tracking', $blocks);
}
}
return parent::removeItemAction($request);
}
} Template Issuesproduct_impression.js.twig
dataLayer.push({'event': 'csProductImpressions', 'ecommerce' : {{ actionData|json_encode()|raw }} }); product_view.js.twig
dataLayer.push({'event': 'csProductDetailImpressions', 'ecommerce': {'detail': {{ actionData|json_encode()|raw }} }}); checkout.js.twig
dataLayer.push({'event': 'csCheckout', 'ecommerce': {'checkout': {{ actionData|json_encode()|raw }} }}); checkout_complete.js.twig
dataLayer.push({'event': 'csPurchase', 'ecommerce' : { 'purchase' : {{ actionData|json_encode()|raw }} } }); |
@solverat thank you for your reply! If it works for you I have to look deeper in our installation. Might be dependent on the payment method, some payment providers have weird redirections. |
The
I might be wrong, but every checkout process - regardless which payment provider is involved - should end there. |
I'll check that, thanks! |
@Cruiser13 I've added the total <> revenue to the to-do list: #1613 (comment) |
fixing some of the listed issues in the ticket Fixed: - trackCheckoutComplete - Rename total to revenue - trackProductImpression - remove quantity, brand, position, attribute - trackCartAdd - quantity is hardcoded to 1. Use $quantity instead Template issues - product_impression.js.twig - product_view.js.twig - checkout.js.twig - checkout_complete.js.twig Not fixed: - trackProductImpression - submit impression as multi- instead of single-array - trackCartAdd - price attribute: I'm not sure about that but I think we need to use the cart item price instead of product price (which often can't be determinate (because of complex variant structure etc.) - trackCartRemove
#1613 TagManagerEnhancedEcommerce
While the trackProduct() function works fine, the JS for the checkout_complete is not being added to the thank you page:
CoreShop/src/CoreShop/Bundle/TrackingBundle/Tracker/Google/TagManager/TagManagerEnhancedEcommerce.php
Line 180 in bab33c0
Others like trackCheckoutStep are working too.
The text was updated successfully, but these errors were encountered: