Traffic Source is always Direct

Hello,

I have setup Countly community edition, everything is working as expected, using all recommended versions from Ubuntu and Node and other dependencies.

My case is that traffic source is always direct, only with certain cases (like Telegram on Android) and also it can see perfectly the device type, only the traffic source is mostly direct where it's not.

My setup is, I have Nginx 1.13.8 as a reverse proxy for node.js on which Countly is running, so I'm suspecting that the headers aren't being correctly passed from Nginx to node, and thus the application is always rendering the traffic source as "Direct", the default one.

However, I'm sure that Nginx configs are set to pass headers to the proxy, here is my nginx configs:

location / {
proxy_pass http://10.21.21.203:80;
proxy_http_version 1.1;

    proxy_set_header Connection 'upgrade';
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_cache_bypass $http_upgrade;

}

10.21.21.203:80 is the server where Ubuntu is because it's on another virtual machine.

So any help or tip is greatly appreciated.

Thanks

0

Comments

8 comments
  • Hello,
    we use HTTP Referer for web app type and package installer for mobile app type to determine source. But we actually collect it as a metric and sent as request data, not in headers. So reverse proxy would not be able to do anything with it.
    Also as you say it works for some cases, so the problem must be somewhere else.
    So what SDK are you using and what is your app type selected for your app in the countly dashboard?

    0
    Comment actions Permalink
  • Hi,

    Thanks for your reply first,

    As you know when you have reverse proxy such as Nginx setting in front of the Node.js App, then the reverse proxy in this case can do much, the requests are hitting Nginx first and then sent to node.js, and thus if Nginx returned a wrong headers then Countly can't process the HTTP Referer, (for example when not forwarding header from Nginx to Node, Nginx will report that 127.0.0.1 is the site referer and not for example from google.com).

    Correct my logic if I'm wrong but as i know it was always this way from tomcat to node today.

    It works in a very specific cases and weirdly enough Only on Android Apps, for example:
    android-app://com.google.android.googlequicksearchbox
    android-app://org.telegram.multi

    I'm not using currently any SDK, I just have normal countly server installed thourgh the auto installation script that you provided.

    And also all native plugins are installed, so that's my issue.

    0
    Comment actions Permalink
  • About SDK I mean, what reports data to server from your app. Is it a website? Or a Mobile up with web content?

    And if web, then web SDK takes HTTP referer on your website and passes it to Countly server as url param, so nginx can't mess it up.

    0
    Comment actions Permalink
  • Hello,
    we found out its actually a bug on visualization part and will be fixed. So the data for most websites are grouped as direct. But if you click on Direct under Analytics -> Sources, you will find multiple domains there.

    We will be grouping them correctly in the next release.

    0
    Comment actions Permalink
  • Hi,
    Happy that the bug was found, however on the Analytics -> Traffic Sources tab, I still don't see much Traffic Sources and mostly direct (http://prntscr.com/irnxnf), and tested from google and various sources still all being shown as direct.

    And yes about my SDK It's web SDK, anyway when I get a bit of time I will debug further on backend level to see if the vistors data are being correctly returned from the Web SDK on the website.

    Greetings,
    Omar

    0
    Comment actions Permalink
  • Try clicking the row with Direct and if it opens up and has lots of domains in it, then it the visual bug that was fixed in dev code and will be available in next closest release

    0
    Comment actions Permalink
  • Hi,
    Yes after clicking the direct i can see much domains, that looks perfect.

    I also saw your fix commit:

    I think i will update now from master branch and see how things go.

    0
    Comment actions Permalink
  • I updated from master branch, and tested, It works much much better now, I tested traffic from google, bing, facebook, twitter, and much mobile applications all works perfectly, just weirdly whatsapp didn't work, but it's not problem at all.

    Thanks for your very fast reaction and fix, have a nice day.

    0
    Comment actions Permalink

Please sign in to leave a comment.