vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Google Analytics code in Mobile template (https://vborg.vbsupport.ru/showthread.php?t=318492)

suko22 04-30-2015 06:46 AM

Google Analytics code in Mobile template
 
Hi, I have a vbulletin 3.8 forum with a Mobile Style for users with Android, Iphone, Ipad or WP. I have this Google Analytics code for both styles (desktop and pc), at the end of 'headinclude':
Code:

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');


  ga('create', 'UA-XXXXXXX', 'auto');
  ga('send', 'pageview');


</script>


Code works perfect in Desktop version, but not in mobile version. In Google Analytics, if I filter visitors by movile devices, nothing appears.


When I review the code in Mobile Style (with chrome) I can see the Google Analytics code, but for any reason it doesn?t work.


Any idea or solution???

RichieBoy67 04-30-2015 07:01 AM

I do not believe Google filters have anything to do with what theme is being used.

suko22 04-30-2015 07:20 AM

Quote:

Originally Posted by RichieBoy67 (Post 2544539)
I do not believe Google filters have anything to do with what theme is being used.

Then explain this. Yesterday I shared a link in Facebook to my forum, after 24 hours facebook stats say that this link had +40.000 clicks. But Google Analytics says it had only 2.900 visitors from Desktop and 140 visitors from Mobile.

My site (forum is just a small part of it) has 70% traffic from mobile devices, 6% tablets and 24% from desktop. So that amount of visitors from desktop (2.900) is normal, but 140 from mobile when Facebook says +40.000 cliks?? I?m sure Google Analitcs code is not working fine in Mobile Style.

RichieBoy67 04-30-2015 07:38 AM

Quote:

Originally Posted by suko22 (Post 2544541)
Then explain this. Yesterday I shared a link in Facebook to my forum, after 24 hours facebook stats say that this link had +40.000 clicks. But Google Analytics says it had only 2.900 visitors from Desktop and 140 visitors from Mobile.

My site (forum is just a small part of it) has 70% traffic from mobile devices, 6% tablets and 24% from desktop. So that amount of visitors from desktop (2.900) is normal, but 140 from mobile when Facebook says +40.000 cliks?? I?m sure Google Analitcs code is not working fine in Mobile Style.

#1 - Is that the newest code or the older one?

#2 - When did you add that code?

#3 - try adding the code to the footer as well in the mobile theme.

suko22 04-30-2015 07:44 AM

Quote:

Originally Posted by RichieBoy67 (Post 2544542)
#1 - Is that the newest code or the older one?

#2 - When did you add that code?

#3 - try adding the code to the footer as well in the mobile theme.

That code is the actual code you can find in G.Analytics settings. I put this code in forum several months ago.
I?ll take your advice and will place code in footer, and will try with this alternative code I found in other website:

Code:

<script type="text/javascript">


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXX']);
  _gaq.push(['_trackPageview']);


  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')                                       
                       
                                [


0]; s.parentNode.insertBefore(ga, s);
  })();


</script>



All times are GMT. The time now is 02:44 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00986 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete