vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Universal Analytics in vBulletin (https://vborg.vbsupport.ru/showthread.php?t=319833)

SWSUSA 08-11-2015 02:21 PM

Universal Analytics in vBulletin
 
Hi! How to insert the code Universal Analytics?

Привет! Как вставить код Universal Analytics?

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-32257551-1', 'auto');
  ga('send', 'pageview');

</script>


Реализация PHP

Создайте файл analyticstracking.php с приведенным выше кодом и добавьте его с помощью директивы include во все шаблоны страниц PHP. Затем добавьте следующую строку на каждый шаблон страницы непосредственно после открывающего тега <body>:
<?php include_once("analyticstracking.php") ?>

RichieBoy67 08-11-2015 03:06 PM

Add it to your headincludes at the bottom.

SWSUSA 08-11-2015 03:15 PM

Quote:

Originally Posted by RichieBoy67 (Post 2552628)
Add it to your headincludes at the bottom.

How to add analyticstracking.php file using the include directive to all page templates PHP?

Как добавить файл analyticstracking.php с помощью директивы include во все шаблоны страниц PHP?

squidsk 08-11-2015 05:35 PM

The code you supplied in the OP is javascript and not php, so does not need to be in a php file.

SWSUSA 08-12-2015 04:28 AM

Quote:

Originally Posted by squidsk (Post 2552649)
The code you supplied in the OP is javascript and not php, so does not need to be in a php file.

Do not understand. Google writes the code in the PHP file.

Не понял. Google пишет добавить код в PHP файл.

RichieBoy67 08-12-2015 04:35 AM

All you have to do is paste the code into your headincludes. You do not need the php file. The headinclude will include it in all your templates.

SWSUSA 08-12-2015 04:44 AM

Quote:

Originally Posted by RichieBoy67 (Post 2552672)
All you have to do is paste the code into your headincludes. You do not need the php file. The headinclude will include it in all your templates.

I am afraid that with this method the speed of loading pages will be more.

Я боюсь, что с помощью такого метода скорость загрузки страниц будет больше.

RichieBoy67 08-12-2015 05:02 AM

Quote:

Originally Posted by SWSUSA (Post 2552673)
I am afraid that with this method the speed of loading pages will be more.

Я боюсь, что с помощью такого метода скорость загрузки страниц будет больше.

Actually if you are that worried about it the code will also work in the footer but most suggest the headincludes. I do not see how adding the code directly to the file is going to be slower than having it called.


All times are GMT. The time now is 06:43 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.01115 seconds
  • Memory Usage 1,730KB
  • 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
  • (1)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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