Yandex Metrika ReachGoal event

If you are runnig Joomla 3.x and Virtuemart 3.x please post to this forum your questions or support tickets about One Page Checkout

Yandex Metrika ReachGoal event

Postby d0ublezer0 » Tue Aug 20, 2019 9:13 am

Hi!
Yandex.metrika uses reachgoal event for his analytic counter
my code form unlogged.tpl:
Code: Select all
<form action="<?php echo $action_url; ?>" method="post" name="adminForm" class="form-donotvalidate"
          novalidate="novalidate"
          onsubmit="ym(21517516, 'reachGoal', 'send-cart'); return true;">

"onsubmit" overwritted by OPC? i cant see this on real page.
Also, i want to catch click on submit button:
Code: Select all
<button <?= $disable_checkout ? "disabled" : "" ?>
                                        type="submit" <?php echo $op_onclick ?> class="btn" id="confirmbtn"
                                        onclick="ym(21517516, 'reachGoal', 'try-cart'); return true;">
                                    Confirm order
                                </button>


how to do this?
d0ublezer0
 
Posts: 14
Joined: Tue Mar 24, 2015 9:26 am

Re: Yandex Metrika ReachGoal event

Postby d0ublezer0 » Tue Aug 20, 2019 10:20 am

I solved this problem by placing the JS code to an external file.
d0ublezer0
 
Posts: 14
Joined: Tue Mar 24, 2015 9:26 am

Re: Yandex Metrika ReachGoal event

Postby admin » Tue Aug 27, 2019 11:06 pm

hello, you can bind via jquery events as far as they don't override the opc's required events, or you can use opc's system to run your own code at form submit:

you can add this to your tabcontent.js
Code: Select all
function yourTrackingFunction() {
//possible return values are:
// true -> OK to proced with submit
// false -> unblock submit button and stop submit
// -1 -> do not unblock submit button and stop submit

}

if (typeof addOpcTriggerer !== 'undefined') {
addOpcTriggerer('callSubmitFunct', 'yourTrackingFunction');
}


best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm


Return to One Page Checkout for Virtuemart 3 on Joomla 3.x

cron