Giter Club home page Giter Club logo

Comments (1)

zwetan avatar zwetan commented on September 2, 2024

The library itself does not detect the device, this is done on the Google Analytics backend.
The GA server when they receive a request deduce the device from the user-agent string.

The first thing you can try is to send the data with POST
see Transport / Using POST

If that still does not correct the problem, you can override the user-agent param
with User Agent Override

In the library you have 2 ways to do that

with the configuration

var config:Configuration = new Configuration();
    config.forcePOST = true;
    config.overrideUserAgent = "(your custom user-agent here)";

var tracker:WebTracker = new WebTracker( "UA-12345-67", config );

with the tracker itself

var tracker:WebTracker = new WebTracker( "UA-12345-67", config );
    tracker.set( Tracker.USER_AGENT_OVERRIDE, "(your custom user-agent here)" );

you can see a small example and some notes here
generateCLIUserAgent.as

in particular this

Note that Google has libraries to identify real user agents.
Hand crafting your own agent could break at any time.

a wrong user-agent could be the reason of a hit request not being
registered by the Google Analytics Servers.

Sniffing / detecting user-agent to extrapolate the OS / device / etc. is a slippery slope
Google Analytics do that on the backend, from the library we have no control over it
even if you copy/paste a real user-agent you took from a device
but somehow GABE does not recognize it, not only it will not change the device / OS / etc.
but it will also ignore the request, eg. your tracking will not appears in the results.

If I was really forced to override the user-agent, I would try to do it in few steps

really test hard with the GA backed that those UA are valid and accepted

from as3-universal-analytics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.