Ad
Send Server Side Google Analytics Data Without Sending Server Location
I am using Google Analytics client side.
Server-side I send e-commerce data and events to Google Analytics. However it's also sending the location of the server. Add the realtime overview I can see a lot of visitors in the same location where the server is located. My guess is that Google Analytics figures from the server-side events the user's location.
How can I prevent this?
var ua = require('universal-analytics');
function sendTransaction(analyticsProperty, {clientId, transactionId, profit}) {
const totalProfit = +profit.toFixed(2);
const visitor = ua(analyticsProperty, {
cid: clientId,
aip: 1
});
visitor.transaction(transactionId, totalProfit).send();
visitor.event('Transaction', 'Complete', '', totalProfit).send();
}
export function transactionCallback(transaction) {
sendTransaction('UA-XXXXXX-1', transaction);
}
Ad
Answer
If you have the users ip you can use the user ip override, location should then be determined from the ip (which is anonymized the same way the aip parameter does).
Specifically build for the purpose is the geographical override. More difficult to implement, since you need to determine the geo id yourself and pass it in via your request.
Ad
source: stackoverflow.com
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad