Your IP : 3.133.7.179
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
createAnalitics('UA-51062187-2');
requireExEcommerce();
// createAnalitics('UA-51062187-2');
function createAnalitics(code) {
ga('create', {
trackingId: code,
cookieDomain: 'auto'
});
}
function requireExEcommerce() {
ga('require', 'ec');
}
//vievAction("tcategory","taction","tlabel");
function vievAction( category, action, label) {
ga('send', {
hitType: 'event',
eventCategory: category,
eventAction: action,
eventLabel: label
});
}
logAnalicics();
function logAnalicics() {
console.log(ga.q);
}
function sendCuncurentPageViev() {
ga('send', {
hitType: 'pageview',
page: location.pathname
});
}
var product1 = {
id:"1",
name:"NAME1",
category:"CATEGORY1",
brand:"BRAND1",
variant:"VARIANT",
list:"LIST",
position:"0",
price:"100",
quantity:1
};
var products0 = [
{
id:"1",
name:"NAME1",
category:"CATEGORY1",
brand:"BRAND1",
variant:"VARIANT",
list:"LIST",
position:"0",
},
{
id:"2",
name:"NAME2",
category:"CATEGORY1",
brand:"BRAND2",
variant:"VARIANT",
list:"LIST",
position:"0"
},
{
id:"2",
name:"NAME2",
category:"CATEGORY2",
brand:"BRAND1",
variant:"VARIANT",
list:"LIST",
position:"0"
}
];
var products1 = [
{
id:"1",
name:"NAME1",
category:"CATEGORY1",
brand:"BRAND1",
variant:"VARIANT",
list:"LIST",
position:"0",
price:"100",
quantity:1
},
{
id:"2",
name:"NAME2",
category:"CATEGORY1",
brand:"BRAND2",
variant:"VARIANT",
list:"LIST",
position:"0",
price:"100",
quantity:1
},
{
id:"2",
name:"NAME2",
category:"CATEGORY2",
brand:"BRAND1",
variant:"VARIANT",
list:"LIST",
position:"0",
price:"100",
quantity:1
}
];
// exEcomShowedProducts(products0);
function exEcomShowedProducts(products) {
products.forEach(function(product) {
ga('ec:addImpression', {
'id': product.id, // Product details are provided in an impressionFieldObject.
'name': product.name,
'category': product.category,
'brand': product.brand,
'variant': product.variant,
'list': product.list,
'position': product.position // 'position' indicates the product position in the list.
});
});
ga('send', 'pageview');
}
// exEcomProductClick(product1,'/');
// Called when a link to a product is clicked.
function exEcomProductClick(product,link) {
ga('ec:addProduct', {
'id': product.id,
'name': product.name,
'category': product.category,
'brand': product.brand,
'variant': product.variant,
'position': 0
});
ga('ec:setAction', 'click', {list: 'product listing'});
// Send click with an event, then send user to product page.
ga('send', 'event', 'UX', 'click', 'Results', {
hitCallback: function() {
document.location = link;
}
});
}
// exEcomShowedProductCard(product1);
function exEcomShowedProductCard(product){
ga('ec:addProduct', {
'id': product.id,
'name': product.name,
'category': product.category,
'brand': product.brand,
'variant': product.variant,
});
ga('ec:setAction', 'detail');
ga('send', 'pageview'); // Send product details view with the initial pageview.
// fbq('track', 'ViewContent');
}
// exEcomAddToCart(product1);
function exEcomAddToCart(product) {
if( typeof product === 'object') {
// Called when a product is added to a shopping cart.
ga('ec:addProduct', {
'id': product.id,
'name': product.name,
'category': product.category,
'brand': product.brand,
'variant': product.variant,
'price': product.price,
'quantity': product.quantity
});
ga('ec:setAction', 'add');
ga('send', 'event', 'UX', 'click', 'add to cart'); // Send data using an event.
// fbq('track', 'AddToCart');
}else {
console.log("product is not object");
}
}
// ecEcomCheckout(products1);
function ecEcomCheckout( products ) {
products.forEach(function(product) {
ga('ec:addProduct', {
'id': product.id,
'name': product.name,
'category': product.category,
'brand': product.brand,
'variant': product.variant,
'price': product.price,
'quantity': product.quantity
});
});
// In the case of checkout actions, an additional actionFieldObject can
// specify a checkout step and option.
ga('ec:setAction','checkout', {
'step': 1, // A value of 1 indicates this action is first checkout step.
'option': 'showCheckout' // Used to specify additional info about a checkout stage, e.g. payment method.
});
ga('send', 'pageview'); // Pageview for payment.html
// fbq('track', 'InitiateCheckout');
}
var transaction0 = {
id:123,
affiliation:"klimatland shop",
revenue:100,
tax:0,
shipping:30,
coupon:""
}
// ecEcomTransaction(products1, transaction0);
function ecEcomTransaction( products, transaction ) {
products.forEach(function(product) {
ga('ec:addProduct', {
'id': product.id,
'name': product.name,
'category': product.category,
'brand': product.brand,
'variant': product.variant,
'price': product.price,
'quantity': product.quantity
});
});
// Transaction level information is provided via an actionFieldObject.
ga('ec:setAction', 'purchase', {
'id': transaction.id,
'affiliation': transaction.affiliation,
'revenue': transaction.revenue,
'tax': transaction.tax,
'shipping': transaction.shipping,
'coupon': transaction.coupon // User added a coupon at checkout.
});
<!-- Event snippet for Оформить заказ conversion page -->
gtag('event', 'conversion', {
'send_to': 'AW-782742383/b8eNCMqt8Y8BEO_mnvUC',
'value': transaction.revenue,
'currency': 'UAH',
'transaction_id': transaction.id
});
ga('send', 'pageview'); // Send transaction data with initial pageview.
// fbq('track', 'Purchase', {value: transaction.revenue, currency: 'UAH'});
}