I try to map my own user agent parameter to the Google Analytics tag (analytics.js). But I cannot get it to include the ua parameter in the request.
The Measurement Protocol states "ua" = override user agent, so it should be available at least.
The toolbox of analytics.js doesn't provide it as a dedicated selection. And simply map it to "ua" doesn't work.
I also tried the set command with different names (ua, useragent, userAgent). Since the referrer has to be setup as "set.referrer" although the Measurement Protocol parameter is named "dr".
Does someone have success with it or knows what I am doing wrong?
It try to avoid editing the template by any means.
08-07-2019 07:02 AM - edited 08-07-2019 07:25 AM
You should be able to make the overide directly in Chrome.
1. Open DevTools
2. Next to the "Elements" tab in DevTools, toggle on the Device Toolbar (it will turn blue when selected and likely resize the page)
3. At the top of the page, you should see "Default" with a drop down arrow, select the dropdown and "Edit"
4. Select "Add Custom Device"
a. Add a Device Name - "MyUserDevice"
b. Add a Custom User Agent String
c. Select "Add"
5. Return to the dropdown at the top of the page and select the device you just added.
This should insert the new user agent string, until you set it back or change it to something else.
UPDATE: Sorry, I missread the issue. When I inspect the GA call I don't see my variable in the request although I do see it in the "Inspect Headers" section when inspecting the call.
08-07-2019 07:47 AM - edited 08-07-2019 07:48 AM
Thank you for your thoughts. Unfortunately that is not what I meant.
I don't want to test fire requests with my spoofed user agent sting.
I want to permanently map a custom data layer parameter to the GA tag as a user agent. In some cases I want to slightly change the default value from navigator.userAgent and sent the updated string instead.
So this should affect a worldwide customer basis requests and not only my test cases.