Common configuration for integrating with Gomag shops.
If you’re asked to upload files for push notifications, you can download the archive from this article.
There is an app on Gomag marketplace, but not always covering all requirements for an end-to-end integration.
Below changes will fix what is missing, and even if those will be fixed at some point in the future, it won’t break anything.
Custom integration Javascript for Gomag
This extra code can be added in Account Settings and Custom JS
Onsite variables are not set through the default integration
Item | Value using jQuery |
cartValue | parseFloat(jQuery(‘.cart-drop .cartPrice’).text()) |
cartCount | parseInt(jQuery(‘.cart-drop .q-cart’).text()) |
Other issues:
- When item size and colors are changed on product page, the addtocart event is lost.
Custom JS Code
Just copy paste this code in Custom JS and missing integration will fix it.
object.tasks.addReadyListener(function() {
_vteq.push(["setVar", "cartValue", parseFloat(jQuery('.cart-drop .cartPrice').text())]);
_vteq.push(["setVar", "cartCount", parseInt(jQuery('.cart-drop .q-cart').text())]);
$('#product-page').on('click', '.__retargetingAddToCartSelector', function() {
window._vteq = window._vteq || [];
window._vteq.push({
'addtocart': {
'itemId': $('.dataProductId .code strong').text().toLowerCase()
}
});
});
});