• 1. I miss pageposttypes for some page types and for terms as single string so that i could use it in GA. This solves it for me:

    add_filter ( 'gtm4wp_compile_datalayer', 'centropol_gtm4wp_compile_datalayer' );
    function centropol_gtm4wp_compile_datalayer($datalayer) {
        if (!array_key_exists('pagePostType2', $datalayer)) {
          if ( is_404() ) {
              $datalayer['pagePostType'] = 'error_404';
              $datalayer['pagePostType2'] = 'error';
          }                                                     
          if ( is_search() ) {
              $datalayer['pagePostType'] = 'search';
              $datalayer['pagePostType2'] = 'search-'.get_query_var('paged');
          }    
          if (is_archive()) $datalayer['pagePostType2'] = 'archive-'.$datalayer['pagePostType'];       
        }
        if ($datalayer['pagePostTerms']) {
            foreach ($datalayer['pagePostTerms'] as $taxonomy => $terms) {
                $datalayer['page-'.$taxonomy] = implode(',',$terms);
            }
        }
    
        return $datalayer;
    }

    2. that information from ipstack are interesting, but you should make the link protocol independent, so instead of
    country_flag”:”http:\/\/assets.ipstack.com\/flags\/cz.svg”
    there should be
    country_flag”:”\/\/assets.ipstack.com\/flags\/cz.svg”
    (ipstack supports both http and https)

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘few small problems’ is closed to new replies.