Status
Not open for further replies.

bzcomputers

Customer
While testing the new Google Analytics options in beta6 I came across an issue on my custom pages.

Currently I am using a 3rd party mod for my analytics which I'm pretty sure hooks into the footer with a javascript to apply the GA code. This is currently working on all my pages including all my custom pages without issue.

For testing I disabled this mod and turned on DBSEO analytics option (ga.js). This option appears to work fine on all vb4 default pages. Switched on universal analytics (analytics.js) and the code changed and again all seems to work well on all vb4 default pages.

Where I ran into issues is on some of my custom pages. The issue is neither code options (gs.js or analytics.js) will display on these pages.

I believe the one unifying factor for all the custom pages where the code will not show up is that they all have an additional mysql connection bringing in data from another database (outside of default vb forum database).

On these custom pages the DBSEO analytics code shows:
Cruise Ship Tracker / Tracking Map (Live) - CRUISIN
Cruise Ship Webcams / Cameras (Live) - CRUISIN

On these custom pages (with a separate db connection) it does not show:
Carnival Breeze Ship Tracker / Tracking Map (Live) - Carnival Cruise Lines - CRUISIN
Carnival Breeze Webcams - Bridge (Forward) Webcam / Camera - Carnival Cruise Lines - CRUISIN
 
I've uploaded a hotfix that solves this - those pages weren't init'd by normal means, so I had to manually initialise DBSEO :)

I reverted to using DP's Analytics mod for the time being, as I'm assuming your profile isn't currently a part of the Universal Analytics program.
 
I've uploaded a hotfix that solves this - those pages weren't init'd by normal means, so I had to manually initialise DBSEO :)

I reverted to using DP's Analytics mod for the time being, as I'm assuming your profile isn't currently a part of the Universal Analytics program.

I did switch my account over to the new Universal Analytics.

I went in and switched the DBSEO analytics back on (disabled the other mod) and it appears I'm still not getting the analytics code to show for those custom pages. I did also shut off the caching to make sure that wasn't an issue to.
 
I had to comment out the cache entry from the config.php file (speaking of, why does it keep reverting to mysql rather than mysqli? If you have the latter available, it's recommended to use that for performance reasons) in order for the code to show up. I tested it, and the code did in fact show up for me on the "ship tracker" page.

For b7 I'll add an automatic purge when you save settings, and a manual purge link in the DBSEO CP.
 
I tested it, and the code did in fact show up for me on the "ship tracker" page.


Yes, it does show up on the ship tracker index page, just not on any of the actual ship tracking pages. Same for the camera pages. The code shows on the index pages, the pages without the second db connection.
 
The reason why it's not showing up on those pages is because those pages are incorrectly coded.

The final line of the files in those pages is
PHP:
echo($templater->render());
when it should be
PHP:
print_output($templater->render());

Please make that correction to all your custom files in order to get Analytics tracking working :) Meanwhile, I have restored the modification to headinclude_bottom.
 
The reason why it's not showing up on those pages is because those pages are incorrectly coded.

The final line of the files in those pages is
PHP:
echo($templater->render());
when it should be
PHP:
print_output($templater->render());

Please make that correction to all your custom files in order to get Analytics tracking working :) Meanwhile, I have restored the modification to headinclude_bottom.

I would switch but then the pages won't render due to errors like this:

Fatal error: Call to undefined method dbPDO::unlock_tables() in /home/cruisin/public_html/forum/includes/functions.php on line 8034
 
Are the tables for the ship tracker on a different database than vBulletin?

What appears to be happening is that the secondary DB connection is overriding vBulletin's DB object, which is extremely bad practice.
 
Update: I have found the workaround for this.

In all your custom files, find
PHP:
$db = new dbPDO();
and change it to
PHP:
$cruiseDB = new dbPDO();
then find
PHP:
$db->prepare
and replace with
PHP:
$cruiseDB->prepare

This will prevent your PDO object from poisoning vBulletin's global variables.
 
That took care of it, analytics code through DBSEO now showing now. Thanks for pointing that out, it definitely saved me some time tracking it down.


Just to make sure ...as far as the settings go on DBSEO analytics, you only need to have the universal setting to yes (for analtics.js) and the setting above it is for just turning on the original code (ga.js)?

Might want to make that clear in the settings that it is either one or the other and that you don't need both on to get the new code, if that is the way it should be.
 
No, you need both set to Yes. The first setting is a global enable toggle, the second setting is for changing ga.js to analytics.js

The second setting will be removed in the future when Universal Analytics is, well, universal :)
 
Status
Not open for further replies.

Legacy DragonByte SEO

vBulletin 3.8.x vBulletin 4.x.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
7,172
Customer rating
5.00 star(s) 1 ratings
Back
Top