Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 32
  1. #21
    Join Date
    Jan 2015
    Posts
    499
    Plugin Contributions
    0

    Default Re: Google Dynamic Remarketing Mod

    Candleman

    I am having the same issue on zencart 1.5.4.

    Just an fyi I have google anaytics installed correctly and all seems good.. So i would not remove that plugin.
    the remarketing tag as mentioned in my previous post is the issue regarding the jsecomm_prodid error.

    If someone could assist us or lead us in the right direction i would greatly appreciate it.

  2. #22
    Join Date
    May 2008
    Posts
    182
    Plugin Contributions
    0

    Default Re: Google Dynamic Remarketing Mod

    I found this today but it's completely over my head.
    https://www.zen-cart.com/content.php...els-to-my-site

    I'm looking deeper into tag manager as I'm also looking to introduce Facebook pixel as well. The beauty of tag manager is that code can be altered via that instead of the zencart code.
    Ideally i need a tag on every page and not just the checkout page.
    www.candlewithcare.co.uk
    Luxury Scented
    Candles at great prices!

  3. #23
    Join Date
    May 2008
    Posts
    182
    Plugin Contributions
    0

    Default Re: Google Dynamic Remarketing Mod

    Right here is where I am.
    I have added the tag manager code onto the file includes/templates/MYTEMPLATE/common/tpl_main_page.php

    I have also gone into my admin/configuration/Google analytics and DISABLED IT
    I have added into Google tag manager (GMT from now on) a tag called universal analytics.
    New, product analytics, tag type analytics, configure enter tracking ID ua-xxxxxxxx and track type page view. Fire on all pages.

    Then again in GTM add a variable under new. Constant and in the value add your GTM code.

    Now, using chrome as a browser (important) I have added a widget onto the browser called Google tag assistant. This then tests your website to see if the tag is present and what it sees.
    I have loaded my Google analytics as well and can see using the real time reporting that I'm on my website.

    Hope this helps
    www.candlewithcare.co.uk
    Luxury Scented
    Candles at great prices!

  4. #24
    Join Date
    Apr 2017
    Location
    Netherlands
    Posts
    20
    Plugin Contributions
    0

    Default Re: Google Dynamic Remarketing Mod

    I am getting this:
    ecomm_prodid: "",
    ecomm_pagetype: "product",
    ecomm_totalvalue: ""

    What do I need to change in the original module to get a product id and total value instead of only empty quotes?
    thx

  5. #25
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    277

    Default Re: Google Dynamic Remarketing Mod

    I spent some time updating this module to be able to report based on ID or Model Number, and to detect product details more accurately on various pages.

    If you were using the prior version, see the download page for the simple upgrade instructions.

    https://www.zen-cart.com/downloads.php?do=file&id=1883
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #26
    Join Date
    Jul 2006
    Location
    Johannesburg
    Posts
    447
    Plugin Contributions
    1

    Default Re: Google Dynamic Remarketing Mod

    Thank you for the upgrade, really appreciate your dedication and your support.

  7. #27
    Join Date
    Jun 2007
    Location
    Texas, USA
    Posts
    1,400
    Plugin Contributions
    1

    Default Re: Google Dynamic Remarketing Mod

    Quote Originally Posted by DrByte View Post
    I spent some time updating this module to be able to report based on ID or Model Number, and to detect product details more accurately on various pages.

    If you were using the prior version, see the download page for the simple upgrade instructions.

    https://www.zen-cart.com/downloads.php?do=file&id=1883

    Thank you! It would be great if it used the $ga_conversion_id that is already entered in from the googleanalytics mod.

    Please consider putting the google analytics and this mod in the standard app.... these are very important to all ecommerce merchants...

    Shrimp

  8. #28
    Join Date
    Jan 2015
    Posts
    499
    Plugin Contributions
    0

    Default Re: Google Dynamic Remarketing Mod

    zencart 1.5.8
    php 8.1

    I made some adjustments on this script to work with the updated analytics. The script is working great. The only question I have is there a way to ignore ez-pages. Does anyone have an idea on how to ignore the e-zpages or url's with the ids

    Code:
    <?php
    // Google Remarketing
    // Dynamic Remarketing tracking code
    // For Zen-Cart 1.5
    // Author: Stef van Dijk - vandijkstef.nl
    
    // This module is delivered as is, without any warranty
    // Feel free to use and edit this module
    // Licensed: GPL - http://www.gnu.org/licenses/licenses.html#GPL
    
    // NOTE: This script only handles products identified by ID or by model-number.
    // It does NOT differentiate products by attribute, nor by other properties such as custom fields like SKU, etc.
    
    // Google conversion ID -- Replace AW-xxxxxxxxxx with your own ID received from Google:
    $ga_conversion_id = 'AW-xxxxxxxxxx';
    
    $product_identifier = 'id'; // can be 'id' or 'model', for the store's product_id or product_model_number respectively
    
    // Pages to ignore
    $pages_to_ignore = array(
        'account', 'account_edit', 'account_history', 'account_history_info', 'account_newsletters',
        'account_notifications', 'account_password', 'address_book', 'address_book_process',
        'advanced_search', 'ask_a_question', 'checkout_confirmation', 'checkout_payment',
        'checkout_payment_address', 'checkout_process', 'checkout_shipping', 'checkout_shipping_address',
        'cookie_usage', 'create_account', 'create_account_success', 'customers_authorization',
        'discount_coupon', 'down_for_maintenance', 'download', 'download_time_out', 'gv_redeem',
        'gv_send', 'info_shopping_cart', 'login', 'logoff', 'page_2', 'page_3', 'page_4',
        'page_not_found', 'password_forgotten', 'payer_auth_auth', 'payer_auth_frame',
        'payer_auth_verifier', 'popup_attributes_qty_prices', 'popup_coupon_help', 'popup_cvv_help',
        'popup_image', 'popup_image_additional', 'popup_search_help', 'popup_shipping_estimator',
        'product_reviews_write', 'redirect', 'shippinginfo', 'ssl_check', 'time_out', 'unsubscribe','search', 'checkout_one','checkout_one_confirmation','site_map','contact_us',
    	  
    );
    
    // Check if the current page is in the ignore list
    if (in_array($current_page_base, $pages_to_ignore)) {
        return;
    }
    
    // DO NOT CHANGE BELOW
    if (empty($ga_conversion_id) || $ga_conversion_id === '123456789') {
        return;
    }
    
    // Product IDs array
    $ecomm_prodid = array();
    $ecomm_totalvalue = 0;
    $ecomm_pagetype = 'other';
    
    // If on a product page, get the product id
    if ($current_page_base === 'product_info') {
        if (!empty($_GET['products_id'])) {
            $product_id = (int)$_GET['products_id'];
            $ecomm_prodid[] = (string)$product_id;
            
            // Get product price
            $product_price_html = zen_get_products_display_price($product_id);
            
            // Use regex to extract the price
            if (preg_match('/<span[^>]*class="[^"]*productSpecialPrice[^"]*"[^>]*>\$([\d,]+\.\d{2})<\/span>/', $product_price_html, $matches)) {
                $ecomm_totalvalue = (float)str_replace(',', '', $matches[1]);
            } elseif (preg_match('/<span[^>]*class="[^"]*normalprice[^"]*"[^>]*>\$([\d,]+\.\d{2})<\/span>/', $product_price_html, $matches)) {
                $ecomm_totalvalue = (float)str_replace(',', '', $matches[1]);
            }
        }
    }
    
    // If on the shopping cart page, add the cart's items to the array
    if ($current_page_base === 'shopping_cart') {
        $cart_products = $_SESSION['cart']->get_products();
        foreach ($cart_products as $product) {
            if ($product_identifier === 'id') {
                $ecomm_prodid[] = (string)(int)$product['id'];
            } elseif ($product_identifier === 'model') {
                $ecomm_prodid[] = (string)$product['model'];
            }
        }
        $ecomm_totalvalue = $_SESSION['cart']->show_total();
    }
    
    // If this is checkout_success, set the products and total value from order
    if ($current_page_base === 'checkout_success') {
        // Retrieve the order ID from the session or the URL
        $order_id = isset($_SESSION['order_number_created']) ? (int)$_SESSION['order_number_created'] : (isset($_GET['order_id']) ? (int)$_GET['order_id'] : 0);
        
        if ($order_id > 0) {
            // Retrieve the products and total value from the order
            $order = $db->Execute("SELECT products_id, products_model, final_price, products_quantity FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = " . $order_id);
            while (!$order->EOF) {
                if ($product_identifier === 'id') {
                    $ecomm_prodid[] = (string)(int)$order->fields['products_id'];
                } elseif ($product_identifier === 'model') {
                    $ecomm_prodid[] = (string)$order->fields['products_model'];
                }
                $ecomm_totalvalue += (float)$order->fields['final_price'] * (int)$order->fields['products_quantity'];
                $order->MoveNext();
            }
        }
    }
    
    
    // Get product IDs from listing or search result pages
    if (empty($ecomm_prodid) && !empty($listing_sql)) {
        $products = $db->Execute($listing_sql);
        while (!$products->EOF) {
            if ($product_identifier === 'id') {
                $ecomm_prodid[] = (string)(int)$products->fields['products_id'];
            } elseif ($product_identifier === 'model' && !empty($products->fields['products_model'])) {
                $ecomm_prodid[] = (string)$products->fields['products_model'];
            }
            $products->MoveNext();
        }
    }
    
    // Map pages to page types
    $page_map = array(
        'search_result' => 'searchresults',
        'index' => 'category',
        'product_info' => 'product',
        'shopping_cart' => 'cart',
        'checkout_success' => 'purchase',
    );
    
    if ($this_is_home_page) {
        $ecomm_pagetype = 'home';
    } elseif (array_key_exists($current_page_base, $page_map)) {
        $ecomm_pagetype = $page_map[$current_page_base];
    }
    
    // Prepare tag parameters
    $tag_params = array(
        'ecomm_prodid' => $ecomm_prodid,
        'ecomm_pagetype' => (string)$ecomm_pagetype,
        'ecomm_totalvalue' => !empty($ecomm_totalvalue) ? round((float)$ecomm_totalvalue, 2) : 0,
    );
    
    ?>
    <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo htmlspecialchars($ga_conversion_id, ENT_QUOTES, 'UTF-8'); ?>"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', '<?php echo htmlspecialchars($ga_conversion_id, ENT_QUOTES, 'UTF-8'); ?>');
      
      // Remarketing tag setup
      gtag('event', 'purchase', <?php echo json_encode($tag_params, JSON_NUMERIC_CHECK); ?>);
    </script>
    Last edited by chadlly2003; 19 Jun 2024 at 08:21 PM.

  9. #29
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,303
    Plugin Contributions
    125

    Default Re: Google Dynamic Remarketing Mod

    Add to the end of $pages_to_ignore

    , 'page'
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  10. #30
    Join Date
    Jan 2015
    Posts
    499
    Plugin Contributions
    0

    Default Re: Google Dynamic Remarketing Mod

    perfect. If anyone is interested in getting the remarketing script this is my final result

    Code:
     <?php
    // Google Remarketing
    // Dynamic Remarketing tracking code
    // For Zen-Cart 1.5
    // Author: Stef van Dijk - vandijkstef.nl
    
    // This module is delivered as is, without any warranty
    // Feel free to use and edit this module
    // Licensed: GPL - http://www.gnu.org/licenses/licenses.html#GPL
    
    // NOTE: This script only handles products identified by ID or by model-number.
    // It does NOT differentiate products by attribute, nor by other properties such as custom fields like SKU, etc.
    
    // Google conversion ID -- Replace AW-xxxxxxxxxx with your own ID received from Google:
    $ga_conversion_id = 'AW-xxxxxxxxxx';
    
    $product_identifier = 'id'; // can be 'id' or 'model', for the store's product_id or product_model_number respectively
    
    // Pages to ignore
    $pages_to_ignore = array(
        'account', 'account_edit', 'account_history', 'account_history_info', 'account_newsletters',
        'account_notifications', 'account_password', 'address_book', 'address_book_process',
        'advanced_search', 'ask_a_question', 'checkout_confirmation', 'checkout_payment',
        'checkout_payment_address', 'checkout_process', 'checkout_shipping', 'checkout_shipping_address',
        'cookie_usage', 'create_account', 'create_account_success', 'customers_authorization',
        'discount_coupon', 'down_for_maintenance', 'download', 'download_time_out', 'gv_redeem',
        'gv_send', 'info_shopping_cart', 'login', 'logoff', 'page_2', 'page_3', 'page_4',
        'page_not_found', 'password_forgotten', 'payer_auth_auth', 'payer_auth_frame',
        'payer_auth_verifier', 'popup_attributes_qty_prices', 'popup_coupon_help', 'popup_cvv_help',
        'popup_image', 'popup_image_additional', 'popup_search_help', 'popup_shipping_estimator',
        'product_reviews_write', 'redirect', 'shippinginfo', 'ssl_check', 'time_out', 'unsubscribe','search', 'checkout_one','checkout_one_confirmation','page',
    );
    
    // Check if the current page is in the ignore list
    if (in_array($current_page_base, $pages_to_ignore)) {
        return;
    }
    
    // DO NOT CHANGE BELOW
    if (empty($ga_conversion_id) || $ga_conversion_id === '123456789') {
        return;
    }
    
    // Product IDs array
    $ecomm_prodid = array();
    $ecomm_totalvalue = 0;
    $ecomm_pagetype = 'other';
    
    // If on a product page, get the product id
    if ($current_page_base === 'product_info') {
        if (!empty($_GET['products_id'])) {
            $product_id = (int)$_GET['products_id'];
            $ecomm_prodid[] = (string)$product_id;
            
            // Get product price
            $product_price_html = zen_get_products_display_price($product_id);
            
            // Use regex to extract the price
            if (preg_match('/<span[^>]*class="[^"]*productSpecialPrice[^"]*"[^>]*>\$([\d,]+\.\d{2})<\/span>/', $product_price_html, $matches)) {
                $ecomm_totalvalue = (float)str_replace(',', '', $matches[1]);
            } elseif (preg_match('/<span[^>]*class="[^"]*normalprice[^"]*"[^>]*>\$([\d,]+\.\d{2})<\/span>/', $product_price_html, $matches)) {
                $ecomm_totalvalue = (float)str_replace(',', '', $matches[1]);
            }
        }
    }
    
    // If on the shopping cart page, add the cart's items to the array
    if ($current_page_base === 'shopping_cart') {
        $cart_products = $_SESSION['cart']->get_products();
        foreach ($cart_products as $product) {
            if ($product_identifier === 'id') {
                $ecomm_prodid[] = (string)(int)$product['id'];
            } elseif ($product_identifier === 'model') {
                $ecomm_prodid[] = (string)$product['model'];
            }
        }
        $ecomm_totalvalue = $_SESSION['cart']->show_total();
    }
    
    // If this is checkout_success, set the products and total value from order
    if ($current_page_base === 'checkout_success') {
        // Retrieve the order ID from the session or the URL
        $order_id = isset($_SESSION['order_number_created']) ? (int)$_SESSION['order_number_created'] : (isset($_GET['order_id']) ? (int)$_GET['order_id'] : 0);
        
        if ($order_id > 0) {
            // Retrieve the products and total value from the order
            $order = $db->Execute("SELECT products_id, products_model, final_price, products_quantity FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = " . $order_id);
            while (!$order->EOF) {
                if ($product_identifier === 'id') {
                    $ecomm_prodid[] = (string)(int)$order->fields['products_id'];
                } elseif ($product_identifier === 'model') {
                    $ecomm_prodid[] = (string)$order->fields['products_model'];
                }
                $ecomm_totalvalue += (float)$order->fields['final_price'] * (int)$order->fields['products_quantity'];
                $order->MoveNext();
            }
        }
    }
    
    
    // Get product IDs from listing or search result pages
    if (empty($ecomm_prodid) && !empty($listing_sql)) {
        $products = $db->Execute($listing_sql);
        while (!$products->EOF) {
            if ($product_identifier === 'id') {
                $ecomm_prodid[] = (string)(int)$products->fields['products_id'];
            } elseif ($product_identifier === 'model' && !empty($products->fields['products_model'])) {
                $ecomm_prodid[] = (string)$products->fields['products_model'];
            }
            $products->MoveNext();
        }
    }
    
    // Map pages to page types
    $page_map = array(
        'search_result' => 'searchresults',
        'index' => 'category',
        'product_info' => 'product',
        'shopping_cart' => 'cart',
        'checkout_success' => 'purchase',
    );
    
    if ($this_is_home_page) {
        $ecomm_pagetype = 'home';
    } elseif (array_key_exists($current_page_base, $page_map)) {
        $ecomm_pagetype = $page_map[$current_page_base];
    }
    
    // Prepare tag parameters
    $tag_params = array(
        'ecomm_prodid' => $ecomm_prodid,
        'ecomm_pagetype' => (string)$ecomm_pagetype,
        'ecomm_totalvalue' => !empty($ecomm_totalvalue) ? round((float)$ecomm_totalvalue, 2) : 0,
    );
    
    ?>
    <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo htmlspecialchars($ga_conversion_id, ENT_QUOTES, 'UTF-8'); ?>"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', '<?php echo htmlspecialchars($ga_conversion_id, ENT_QUOTES, 'UTF-8'); ?>');
      
      // Remarketing tag setup
      gtag('event', 'purchase', <?php echo json_encode($tag_params, JSON_NUMERIC_CHECK); ?>);
    </script>

 

 
Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Dynamic Filter [Support Thread]
    By davowave in forum Addon Sideboxes
    Replies: 808
    Last Post: 19 May 2025, 08:37 PM
  2. v150 Support Thread for Google reCAPTCHA plugin
    By David Allen in forum All Other Contributions/Addons
    Replies: 672
    Last Post: 25 Feb 2025, 12:17 PM
  3. v150 Google Merchant Center Feeder for ZC v1.5.x [Support Thread]
    By DivaVocals in forum Addon Admin Tools
    Replies: 504
    Last Post: 19 Nov 2024, 03:50 PM
  4. Welcome, Google Searcher [Support Thread]
    By swguy in forum All Other Contributions/Addons
    Replies: 24
    Last Post: 8 Jan 2017, 04:47 PM
  5. Google Base Feeder Support Thread [OLD]
    By numinix in forum All Other Contributions/Addons
    Replies: 3562
    Last Post: 2 Apr 2012, 06:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR