jQuery(function($) { tvc_lc="EUR"; homepage_json_ATC_link=[]; tvc_fp=[]; tvc_rcp=[]; tvc_rdp=[]; prodpage_json_ATC_link=[]; tvc_pgc={"https:\/\/www.zankyou.de\/paper\/partyvorhang":{"tvc_id":"6925","tvc_i":"5900779112131","tvc_n":"Partyvorhang","tvc_p":"10.79","tvc_c":"Deko und Geschenke Shop,Hochzeitsdekoration,Photo Booth\/Fotoecke Hochzeit"},"https:\/\/www.zankyou.de\/paper\/rote-lippen-auf-stab-fotoecke":{"tvc_id":"6715","tvc_i":"5901157463203","tvc_n":"Rote Lippen auf Stab f\u00fcr die Fotoecke","tvc_p":"2.00","tvc_c":"Deko und Geschenke Shop,Hochzeitsfeier,Photo Booth\/Fotoecke Hochzeit"},"https:\/\/www.zankyou.de\/paper\/foto-requisiten-liebe-liegt-in-der-luft":{"tvc_id":"6711","tvc_i":"5902230776142","tvc_n":"Foto-Requisiten Liebe liegt in der Luft","tvc_p":"2.09","tvc_c":"Deko und Geschenke Shop,Hochzeitsfeier,Junggesellenabschied,Photo Booth\/Fotoecke Hochzeit"},"https:\/\/www.zankyou.de\/paper\/slefie-fotorahmen-she-said-yes":{"tvc_id":"6305","tvc_i":"5900779106734","tvc_n":"Slefie-Fotorahmen She said yes","tvc_p":"6.19","tvc_c":"Deko und Geschenke Shop,Junggesellenabschied,Photo Booth\/Fotoecke Hochzeit"},"https:\/\/www.zankyou.de\/paper\/holzwegweiser-fotokabine":{"tvc_id":"6198","tvc_i":"5902230797314","tvc_n":"Holzwegweiser Fotokabine","tvc_p":"9.99","tvc_c":"Deko und Geschenke Shop,Hochzeitsdekoration,Photo Booth\/Fotoecke Hochzeit,Schilder und Buchstaben"},"https:\/\/www.zankyou.de\/paper\/selfie-fotorahmen-set-best-wedding":{"tvc_id":"6166","tvc_i":"5900779104044","tvc_n":"Selfie-Fotorahmen-Set - Best Wedding","tvc_p":"6.99","tvc_c":"Deko und Geschenke Shop,Hochzeitsdekoration,Photo Booth\/Fotoecke Hochzeit"},"https:\/\/www.zankyou.de\/paper\/folienballon-love":{"tvc_id":"5965","tvc_i":"5900779131071","tvc_n":"Folienballon Love","tvc_p":"5.39","tvc_c":"Deko und Geschenke Shop,Hochzeitsdekoration,Luftballons f\u00fcr die Hochzeit,Photo Booth\/Fotoecke Hochzeit"}}; catpage_json_ATC_link={"?add-to-cart=6925":{"ATC-link":"https:\/\/www.zankyou.de\/paper\/partyvorhang"},"?add-to-cart=6715":{"ATC-link":"https:\/\/www.zankyou.de\/paper\/rote-lippen-auf-stab-fotoecke"},"?add-to-cart=6711":{"ATC-link":"https:\/\/www.zankyou.de\/paper\/foto-requisiten-liebe-liegt-in-der-luft"},"?add-to-cart=6305":{"ATC-link":"https:\/\/www.zankyou.de\/paper\/slefie-fotorahmen-she-said-yes"},"?add-to-cart=6198":{"ATC-link":"https:\/\/www.zankyou.de\/paper\/holzwegweiser-fotokabine"},"?add-to-cart=6166":{"ATC-link":"https:\/\/www.zankyou.de\/paper\/selfie-fotorahmen-set-best-wedding"},"?add-to-cart=5965":{"ATC-link":"https:\/\/www.zankyou.de\/paper\/folienballon-love"}}; var items = []; //set local currencies gtag("set", {"currency": tvc_lc}); function t_products_impre_clicks(t_json_name,t_action){ t_send_threshold=0; t_prod_pos=0; t_json_length=Object.keys(t_json_name).length; for(var t_item in t_json_name) { t_send_threshold++; t_prod_pos++; items.push({ "id": t_json_name[t_item].tvc_i, "name": t_json_name[t_item].tvc_n, "category": t_json_name[t_item].tvc_c, "price": t_json_name[t_item].tvc_p, }); if(t_json_length > 6 ){ if((t_send_threshold%6)==0){ t_json_length=t_json_length-6; gtag("event", "view_item_list", { "event_category":"Enhanced-Ecommerce", "event_label":"product_impression_"+t_action, "items":items,"non_interaction": true}); items = []; } }else{ t_json_length--; if(t_json_length==0){ gtag("event", "view_item_list", { "event_category":"Enhanced-Ecommerce", "event_label":"product_impression_"+t_action, "items":items,"non_interaction": true}); items = []; } } } } //function for comparing urls in json object function prod_exists_in_JSON(t_url,t_json_name,t_action){ if(t_json_name.hasOwnProperty(t_url)){ t_call_fired=true; gtag("event", "select_content", { "event_category":"Enhanced-Ecommerce", "event_label":"product_click_"+t_action, "content_type": "product", "items": [ { "id":t_json_name[t_url].tvc_i, "name": t_json_name[t_url].tvc_n, "category":t_json_name[t_url].tvc_c, "price": t_json_name[t_url].tvc_p, } ], "non_interaction": true }); }else{ t_call_fired=false; } return t_call_fired; } function prod_ATC_link_exists(t_url,t_ATC_json_name,t_prod_data_json,t_qty){ t_prod_url_key=t_ATC_json_name[t_url]["ATC-link"]; if(t_prod_data_json.hasOwnProperty(t_prod_url_key)){ t_call_fired=true; // Enhanced E-commerce Add to cart clicks gtag("event", "add_to_cart", { "event_category":"Enhanced-Ecommerce", "event_label":"add_to_cart_click", "non_interaction": true, "items": [{ "id" : t_prod_data_json[t_prod_url_key].tvc_i, "name":t_prod_data_json[t_prod_url_key].tvc_i, "category" : t_prod_data_json[t_prod_url_key].tvc_c, "price": t_prod_data_json[t_prod_url_key].tvc_p, "quantity" :t_qty }] }); }else{ t_call_fired=false; } return t_call_fired; } //category page json if(tvc_pgc.length !== 0){ t_products_impre_clicks(tvc_pgc,"cp"); } //Prod category ATC link click in related product section jQuery("a:not(.product_type_variable, .product_type_grouped)").on("click",function(){ t_url=jQuery(this).attr("href"); //cat page prod call for click prod_exists_in_JSON(t_url,tvc_pgc,"cp"); }); //ATC link click jQuery("a[href*=add-to-cart]").on("click",function(){ t_url=jQuery(this).attr("href"); t_qty=$(this).parent().find("input[name=quantity]").val(); //default quantity 1 if quantity box is not there if(t_qty=="" || t_qty===undefined){ t_qty="1"; } prod_ATC_link_exists(t_url,catpage_json_ATC_link,tvc_pgc,t_qty); }); tvc_smd={"tvc_wcv":"5.8.0","tvc_wpv":"5.8.1","tvc_eev":"2.1.6","tvc_cnf":{"t_ee":"on","t_df":false,"t_gUser":false,"t_UAen":null,"t_thr":6,"t_IPA":false,"t_OptOut":false,"t_PrivacyPolicy":true}}; });