NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<?php
//Check if is homepage
$woo_prefix = '';/* Merchant center prefix for products*/
global $woocommerce;
$is_sku = false; /*If sku is used in merchant center change $is_sku variable to true*/
if ( is_front_page() ) {
?>

<script type="text/javascript">

//initializing the variable (declared)
var dataLayer = window.dataLayer || [];

dataLayer.push({
'event': 'fireRemarketingTag',
'google_tag_params': {
'ecomm_pagetype': 'home'
}
});
</script>

<?php
}
// Check if it is a product category page and set the category parameters.
elseif ( is_product_category() ) {
?>

<script type="text/javascript">
var dataLayer = window.dataLayer || [];

dataLayer.push({
'event': 'fireRemarketingTag',
'google_tag_params': {
'ecomm_pagetype': 'category'
}
});
</script>
<?php
}
// Check if it a search results page and set the searchresults parameters.
elseif ( is_search() ) {
?>

<script type="text/javascript">
var dataLayer = window.dataLayer || [];

dataLayer.push({
'event': 'fireRemarketingTag',
'google_tag_params': {
'ecomm_pagetype': 'searchresults'
}
});
</script>
<?php
}
// Check if it is a product page and set the product parameters.
elseif ( is_product() ) {
$product_id = get_the_ID();
$product = wc_get_product($product_id);
if($is_sku){
$product_id = $woo_prefix.$product->get_sku();
}
else{
$product_id = $woo_prefix.$product->id;
}
$price = $product->get_price();
?>
<script type="text/javascript">

var dataLayer = window.dataLayer || [];

dataLayer.push({
'event': 'fireRemarketingTag',
'google_tag_params': {
'ecomm_prodid': '<?php echo $product_id ?>',
'ecomm_pagetype': 'product',
'ecomm_totalvalue': <?php echo $price ?>
}
});
</script>
<?php

}
// Check if it is the cart page and set the cart parameters.
elseif ( is_cart() ) {
$cartprods = $woocommerce->cart->get_cart();
$cartprods_items = array();
foreach ( (array) $cartprods as $entry ) {
if($is_sku){
$sku = $entry['data']->get_sku();
//echo "SKU is ".$woo_prefix.$sku;
array_push( $cartprods_items, "'".$woo_prefix.$sku."'" );
}
else{
array_push( $cartprods_items, "'".$woo_prefix.$entry['product_id']."'" );
}
}
?>

<script type="text/javascript">

var dataLayer = window.dataLayer || [];

dataLayer.push({
'event': 'fireRemarketingTag',
'google_tag_params': {
'ecomm_prodid': <?php echo '['.implode(',',$cartprods_items).']';?>,
'ecomm_pagetype': 'cart',
'ecomm_totalvalue': <?php echo $woocommerce->cart->cart_contents_total; ?>
}
});
</script>
<?php
}
// Check if it the order received page and set the according parameters
elseif ( is_order_received_page() ) {

$order_key = $_GET['key'];
$order = new WC_Order( wc_get_order_id_by_order_key( $order_key ) );
$order_total = $order->get_total();

// Only run conversion script if the payment has not failed. (has_status('completed') is too restrictive)
// And use the order meta to check if the conversion code has already run for this order ID. If yes, don't run it again.
if ( ! $order->has_status( 'failed' )) {
$order_items = $order->get_items();
$order_items_array = array();
foreach ( (array) $order_items as $item ) {
if($is_sku){
$product = new WC_Product($item['product_id']);
$sku = $product->get_sku();
array_push( $order_items_array, "'".$woo_prefix.$sku."'" );
}
else{
array_push( $order_items_array, "'".$woo_prefix.$item['product_id']."'" );
}
}
?>

<script type="text/javascript">

var dataLayer = window.dataLayer || [];

dataLayer.push({
'event': 'fireRemarketingTag',
'google_tag_params': {
'ecomm_prodid': <?php echo '['.implode(',',$order_items_array).']';?>,
'ecomm_pagetype': 'purchase',
'ecomm_totalvalue': <?php echo $order_total; ?>
}
});
</script>
<?php
} // end if order status
}
// For all other pages set the parameters for other.
else {
?>
<script type="text/javascript">

var dataLayer = window.dataLayer || [];

dataLayer.push({
'event': 'fireRemarketingTag',
'google_tag_params': {
'ecomm_pagetype': 'other'
}
});
</script>
<?php
}
?>

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.