• Resolved peter_lang

    (@peter_lang)


    I am using Google Tag Manager for my page. All works fine but actually i wanto that the Tag Managewr will be added only in my country and track here. So if someone visit my page from antoher country the Tag Manager script should not be activated or placed in the page code.

    Is this possible?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter peter_lang

    (@peter_lang)

    Also possible but i would prefer to insert the code only by these 2 languages.
    I have created a script thta works by these 2 with simple echo results but everytime i add the GTM script, the pagelayout is destroyd …

    <?php
       // If language is Deutsch
        if ( defined( 'ICL_LANGUAGE_CODE' ) && 'de' == ICL_LANGUAGE_CODE ) {
            //Deutsch Content here;
     	    
          <script> </script>
    
              
    		
        }
        // If language is French
        else if ( defined( 'ICL_LANGUAGE_CODE' ) && 'fr' == ICL_LANGUAGE_CODE ) {
            //French Content here
           
            
        }
        // Just for debug, you can remove this
        else {
           echo('No tracking code added');
        }
    ?>

    That’s bc this is wrong:
    <script> </script>

    Change it to this:
    echo “<script> </script>”;

    Also, not sure if this is wrong as well, but I don’t think I’ve seen echo used this way:
    echo(‘No tracking code added’);

    Change it to this:
    echo “No tracking code added”;

    Thread Starter peter_lang

    (@peter_lang)

    yes, thats it. Script closed in echo works now, i forgot the semicolon .. dios mio …

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add Tag Manager for only one country’ is closed to new replies.