: Are there different ways to fire enhanced commerce Google Analytics events? Is it possible to change following code from: ga('ec:setAction', 'checkout', { step: 1, option: 'foobar' });
Is it possible to change following code from:
ga('ec:setAction', 'checkout', {
step: 1,
option: 'foobar'
});
to:
ga('ec:setAction', {
type: 'checkout',
step: 1,
option: 'foobar'
});
I am using Magento and we use linked accounts. So I wrote a wrapper and I want avoid such code:
/**
* GA Wrapper for Linked Accounts.
*
* @param string action
* @param mixed mixed
* @param obj data
* @private
*/
var _ga = function(action, mixed, data) {
if(typeof(mixed) == 'object' && !data) {
ga(action, mixed);
<?php if (strlen($helper->isLinkAccountsEnabled()) > 0):?>
ga('<?php echo $helper->getLinkedAccountName()?>.' + action, mixed);
<?php endif;?>
} else if(data) {
ga(action, mixed, data);
<?php if (strlen($helper->isLinkAccountsEnabled()) > 0):?>
ga('<?php echo $helper->getLinkedAccountName()?>.' + action, mixed, data);
<?php endif;?>
}
}
More posts by @Murphy175
1 Comments
Sorted by latest first Latest Oldest Best
The setAction object needs to know the type before it processes the values you feed it. 'type' is not a valid value to pass. You'll need to have your code insert a valid type into the function before it processes the values.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.