tag manager google
-
What code I need to add to my theme functions.php son customizr to add tags manager google ?
-
Have a good weekend . Until next time , bye
Eheh, you too! π
hi d4. Can you help me with a code?
If I’m able π
good morning d4z_c0nf , sorry for not replying earlier, is that I have problems with internet connection . I need help with Jquery code.I want to create a custom label on google html tag manager to measure the clicks in the categories of my blog.First I have to include the jQuery library on my website . Is the subject customizr have it included ?
Yes, customizr uses wordpress jQuery library π
ok . What for measuring clicks in the categories menu on my blog, as would be the basis of the source code of the page ?. For the average social class I have this source
<li id=”menu-item-315″ class=”menu-item menu-item-type-taxonomy menu-item-object-category menu-item-315″>Social Media
To measure search clicks and clicks on the items comprising this category, would it be okay if I put $ ( “category menu- item- 315 ” ) . click ( function () { ?Mm,
put the ode in wp_footer like the code above, but instead of using__before_header, use ‘wp_footer’, Then write the jquery code the right way (http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers).
So in your case something like:jQuery(document).ready(function($) { // Inside of this function, $() will work as an alias for jQuery() // and other libraries also using $ will not be accessible under this shortcut $( "#menu-item-315" ).click( function() { });hope this helps
Thanks for teaching . And as I have five categories in my blog , social media , web analytics, marketing , wordpress and Seo, I want to measure the clicks in all of them and clicks on items that are no grouped into each of them , would it be okay if I put in brackets the class of each category with your id ?
JQuery (document) .ready(function ($){
$(“#Menu-item-315”, “#Menu-item-1331″,”#Menu-item-1645”, “#Menu-item-1685″,”#Menu-item-1964”).click(function(){
and now that line of code follows him to send the event . Would it be okay if I put var href = $ (this ) .attr ( ‘href ‘); DataLayer . push ( ?I have to disconnect from the Internet. I reconnect the afternoon and read your response. until later , bye
Mmm,
something like:add_action('wp_footer', 'my_script'); function my_script(){ ?> <script text="javascript"> jQuery(document).ready(function($) { var $menu_items = $('#menu-item-315, #menu-item-1331, #menu-item-1645, #menu-item-1685, #menu-item-1964'); $($menu_items).children('a[href!=""]').click(function(){ var href=$(this).attr('href'); DataLayer.push ( }); }); </script> <?php }p.s.
where’s menu-item-1685 ? I see in your page menut-item-1781 ..d4 hello thanks for helping me with the code.I was wrong , you have your reason is 1781.This code is going to put in Google Tag Manager in a custom html tag. So I do not put add action .. I start from <script text=”javascript”> …
What category , share and tag put after datalayer.push to correctly measure the clicks ?
thank you d4
Hi leblanc1,
I missed your previous reply, did you solve then?
The topic ‘tag manager google’ is closed to new replies.
