1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Bug Xenforo Version: Not Tracking Content Creation Events

Discussion in 'Better Analytics' started by Sean Kendle, Oct 4, 2016.

  1. #1
    I've installed the plugin, and I believe it's properly set up.

    I can't find anywhere in the code where it might be trying to log content creation events, and I have posted several new threads and replies, and have seen no events tracked for those in Google Analytics.

    The "User Engagement" event has happened a lot, but nothing else. Can you please help with this? We want to upgrade to the full paid version but we can't if it's not tracking content creation, as that's the main reason we want this add-on.
     
    Solved! View solution.
    Sean Kendle, Oct 4, 2016 IP
  2. #2
    Most of the event tracking (including content creation events) are just in the Pro version.
     
    digitalpoint, Oct 4, 2016 IP
  3. Sean Kendle

    Sean Kendle Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    Ok, just FYI the option to enable Content Creation tracking is not greyed out in the trial version. Also, there are two questions on the Xenforo board that asked this same question. Thanks!
     
    Sean Kendle, Oct 5, 2016 IP
  4. Sean Kendle

    Sean Kendle Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    What is your policy on refunds? We want to try out the full version, but if it doesn't end up being what we're looking for, can we get a refund or are all sales final?
     
    Sean Kendle, Oct 5, 2016 IP
  5. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #5
    Sorry, there aren't refunds/trial periods. What exactly are you wanting it to do for you? I should be able to tell you. The Pro version works exactly the same just with extra features is all.
     
    digitalpoint, Oct 5, 2016 IP
  6. Sean Kendle

    Sean Kendle Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #6
    More or less, we're trying to see how it affects data in a Google Analytics account before going live with the full version. We have a development server set up locally, so we should be able to test exactly what kind of data is provided. We just want to be careful not to affect data in the main account before deciding if this is the solution for us. I believe we've mostly answered those questions and will move forward with purchasing this add-on, so thank you for your time and attention!
     
    Sean Kendle, Oct 5, 2016 IP
  7. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #7
    The Pro features can all be individually disabled if there is something specific it does that you don't want it to track (for example maybe you don't care about AJAX calls). So if the normal version is working okay for what you want it to do, the rest (Pro stuff) is all optional. It's not going to start tracking page views or any of the core stuff differently or anything if that's your worry.
     
    digitalpoint, Oct 5, 2016 IP
  8. Sean Kendle

    Sean Kendle Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #8
    We purchased the add-on, and it's still not logging any of the events it's supposed to. Is there something I should do after registering our domains? Does this work on subdomains of the main domain? We have a localhost copy of the site for testing that we need to use before pushing to the production server. I use a subdomain and my internal HOSTS file to connect to the local server. Is that potentially a problem?
     
    Sean Kendle, Oct 24, 2016 IP
  9. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #9
    If the server is on a non-routeble IP and can't reach Google's servers, yes it will be a problem. Does the server see you have a Pro license?
     
    digitalpoint, Oct 24, 2016 IP
  10. Sean Kendle

    Sean Kendle Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #10
    Yeah, all the options are enabled. I don't see why it couldn't reach Google's servers, it's able to reach, for example, Marketo's REST API via cUrl requests. Unless I'm misunderstanding you.
     
    Last edited: Oct 24, 2016
    Sean Kendle, Oct 24, 2016 IP
  11. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #11
    Any chance you could put it on a publicly rechable test site so I could take a look?
     
    digitalpoint, Oct 24, 2016 IP
  12. Sean Kendle

    Sean Kendle Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #12
    No, we don't have a publicly reachable test site, unfortunately. We need to test this on a local Apache server (XAMPP) before going to production.
     
    Sean Kendle, Oct 25, 2016 IP
  13. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #13
    Hmm... yeah it's tough to say what may or may not be going on without a site to look at. Could be a lot of different things. Off the top of my head, here are somethings to look at:
    • Different addon that is completely overriding methods rather than extending like it's suppose to.
    • Custom style that changes the the normal order of JavaScript files.
    • JavaScript errors from unrelated scripts can cause all JavaScript downstream to halt.
    • Server connectivity issue between server and Google.
    • Misconfiguration (like wrong or missing property ID).
     
    digitalpoint, Oct 25, 2016 IP
  14. Sean Kendle

    Sean Kendle Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #14
    Well, I can narrow it down for you:

    It's not the javascript, those events and dimensions are working perfectly fine. I did have to replace your "send, pageview" to my own because we already have custom dimensions that I need to send in, and needed to delay sending pageview until later on. I can also see myself using the Real Time view in GA.

    What seems to not be logging events are the "view attachments" and "content creation", etc. I don't know about the view attachments code but the content creation seems to be using a back end function. I ran the debugger, and it's definitely running the line in "Post.php":

    
              DigitalPointBetterAnalytics_Helper_Analytics::getInstance()->event(
                    XenForo_Application::getOptions()->googleAnalyticsWebPropertyId,
                    @$customFields['analytics_cid'],
                    XenForo_Visitor::getUserId(),
                    @$_SERVER['REMOTE_ADDR'],
                    'Content',
                    'Post',
                    @$thread['title']
              );
    
    Code (markup):
    I could add further breakpoints later in the code, like in the DigitalPointBetterAnalytics_Helper_Analytics Class.

    My configuration seems to be fine, but I have no proof of that. I put in the GA "UI-" id, and set up the back end, it seems to have found everything properly:

    Screenshot of my options (greyed out sensitive info):

    [​IMG]
     
    Sean Kendle, Oct 25, 2016 IP
  15. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #15
    So you are seeing the event() method being called within the DigitalPointBetterAnalytics_Helper_Analytics helper class?

    Once it gets to that point it's (almost) out of our control. Double check that you can reach the API URL from the server. From the shell something like this is a quick way to tell (this will give you the HTTP headers for the request):

    curl -I https://www.google-analytics.com/collect
    Code (markup):
    One thing I can think of is if your server has IPv6 enabled, but no IPv6 gateway. Google's IP addresses would resolve to IPv6 addresses, but when the server tries to reach it, there would be no route.

    Other than that, if your PHP curl extensions is reporting it is multithreaded capable, but it's really not (not sure why or how that would be the case), that would do it too.

    You could try forcing it to *not* use curlmulti by changing this:

    protected static function _canUseCurlMulti()
    	{
    		if (empty(XenForo_Application::getOptions()->dpAnalyticsInternal['v']))
    		{
    			return false;
    		}
    
    		return function_exists('curl_multi_init');
    	}
    PHP:
    to this:

    protected static function _canUseCurlMulti()
    	{
    		return false;
    		if (empty(XenForo_Application::getOptions()->dpAnalyticsInternal['v']))
    		{
    			return false;
    		}
    
    		return function_exists('curl_multi_init');
    	}
    PHP:
     
    digitalpoint, Oct 25, 2016 IP
  16. Sean Kendle

    Sean Kendle Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #16
    Looks like returning false in _canUseCurlMulti did the trick, although I can't pretend to understand why. I'm fairly new at PHP and I'm just running XAMPP on a Windows machine here. I was unable to run the curl command in my console. I downloaded and unzipped curl, and added its directory path to Windows's Environmental Variables Path, but I get this error:

    How exactly does the add-on track attachment views? On loading a thread with attachments in it, or when you click them? FYI, I'm also using another add-on that forces attachments to be generated inline in the post, rather than having the little box with the attachment in it like the default behavior.

    What types of content are tracked? We have XenGallery installed, will it track when people add photos/videos and albums to that?
     
    Sean Kendle, Oct 26, 2016 IP
  17. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #17
    Not sure what's going on with your curl in that setup. It's been a long, long, long, long time since I had a look at a Windows server (Windows NT 3.x days, so more than 20 years ago).

    What version of PHP and curllib are you using? If it's not the latest, it probably wouldn't hurt to update them.

    Attachment views events are logged based on the same criteria that XenForo considers a "view" (it just piggybacks XenForo's method for logging attachments views). I believe you have to actually view the attachment (not just view a thread that has a downloadable attachment). Image attachments that are inline (within a post) will log it as a view since the image is being download to view in the post.

    It doesn't log non-standard content types, although it would be easy enough for a third-party add-on to utilize the internal functions to do so. Would just be a single method call at the appropriate time in their code.

    Content creation that can be logged by default is as follows:
    • New Conversation Message
    • New Thread Post
    • New Profile Post
     
    digitalpoint, Oct 26, 2016 IP
  18. Sean Kendle

    Sean Kendle Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #18
    PHP is v5.4 and I'm not sure what version of curl, it's all prepackaged with XAMPP. It could very well just be the XAMPP implementation on a Windows machine not being properly set up.

    Ok, well, since I saw that it logged some of the events, I think it's fairly safe to go ahead with installing this on the live site. We have to be super careful because in GA you can't delete data, and this is a very large client with multiple sites, so it's important that we don't screw up their data at all! Mostly from the standpoint of that we're logging custom dimensions already and have to make sure that data continues to be collected, which is entirely on me. Thanks for your replies, I'll let you know if this doesn't work on the live server.

    I might create my own helper functions to log creation of media/albums. If you want I can share that code with you afterwards that you could package into a sort of optional add-on to your add-on. I think XenGallery is fairly popular.
     
    Sean Kendle, Oct 26, 2016 IP
  19. Sean Kendle

    Sean Kendle Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #19
    Ok, I've installed this on our two production websites, and everything seems to be working.

    However, our sites each have two separate "Views" in Google Analytics. For one site I'm able to see the two Views. For the other site I only see one View, and the View isn't named the same as either actual View in the GA admin panel.

    Thoughts?

    A helpful change would be to show the actual GA ID's (Property and View) in the drop down list as well. That would eliminate any confusion, because we have some very similarly named Properties and Views (including an unused old Property that's named the same).

    In addition to this, the older Property isn't being shown at all. Might that be because it wasn't set up as a "Universal Analytics" property?
     
    Sean Kendle, Nov 10, 2016 IP
  20. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #20
    Are you talking about for reporting with the addon?
     
    digitalpoint, Nov 10, 2016 IP