Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Js detecting script does not detect cookie passed with sitespeed #2489

Closed
gety9 opened this issue May 31, 2019 · 21 comments
Closed

Js detecting script does not detect cookie passed with sitespeed #2489

gety9 opened this issue May 31, 2019 · 21 comments

Comments

@gety9
Copy link

gety9 commented May 31, 2019

Guys hi,

I am running the following command:

docker run --shm-size=1g --network=cable --rm -e TZ=America/New_York -v /usr/share/zoneinfo/America/New_York:/etc/localtime:ro -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:8.2.2-plus1 --browsertime.iterations 1 --browsertime.cookie trafficType=testing --grafana.host XX.XXX.XX.XXX --grafana.port 80 --grafana.auth XXXXXXX --graphite.host XX.XXX.XX.XXX --graphite.port 2003 --graphite.auth runner:XXXXXXX --graphite.annotationScreenshot true --graphite.namespace sitespeed_io.z-ohio-tmp --s3.key XXXXXXX --s3.secret XXXXXXX --s3.bucketname XXXXXXX --s3.region us-east-2 --s3.removeLocalResult true --chrome.timeline true --resultBaseURL http://XXXXXXX.s3-website.us-east-2.amazonaws.com --mobile false --connectivity cable https://www.sitename.com/'

and getting following result

Google Chrome 72.0.3626.81 \nMozilla Firefox 65.0\n[2019-05-31 10:52:51] INFO: Versions OS: linux 4.15.0-1039-aws nodejs: v10.13.0 sitespeed.io: 8.2.2 browsertime: 4.2.4 coach: 3.2.0\n[2019-05-31 10:52:51] INFO: Will run Lighthouse tests after Browsertime has finished\n[2019-05-31 10:52:51] INFO: Sending url https://www.sitename.com/ to test on Page Speed Insights\n[2019-05-31 10:52:51] INFO: Running tests using Chrome - 1 iteration(s)\n[2019-05-31 10:52:52] INFO: Testing url https://www.sitename.com/ iteration 1\n[2019-05-31 10:52:56] INFO: Got https://www.sitename.com/ analysed from Google Page Speed Insights\n[2019-05-31 10:53:14] INFO: https://www.sitename.com/ 50 requests, 744.20 kb, backEndTime: 302ms, firstPaint: 493ms, firstVisualChange: 500ms, DOMContentLoaded: 773ms, Load: 1.66s, speedIndex: 646, visualComplete85: 666ms, lastVisualChange: 1.17s, rumSpeedIndex: 1059\n[2019-05-31 10:53:14] INFO: Will collect Lighthouse metrics for https://www.sitename.com/\n[2019-05-31 10:53:21] INFO: Got Lighthouse metrics\n[2019-05-31 10:53:22] INFO: HTML stored in /sitespeed.io/sitespeed-result/www.sitename.com/2019-05-31-10-52-51\n[2019-05-31 10:53:22] INFO: Uploading /sitespeed.io/sitespeed-result/www.sitename.com/2019-05-31-10-52-51 to S3 bucket XXXXXXX, this can take a while ...\n[2019-05-31 10:53:24] INFO: Finished upload to s3\n[2019-05-31 10:53:24] INFO: Find the result at http://XXXXXXX.s3-website.us-east-2.amazonaws.com/www.sitename.com/2019-05-31-10-52-51\n

I am using following script to change Google Analytic Ids for testing traffic (so test is as close as possible to speed experienced by real user, without polluting analytics of real account)

function(){
  if(!({{Traffic type _cookies}}=='testing')){
    	return {{Google Analytics ID}};
	}else{
  		return 'UA-00000000-0';
	}
}

If i manually go to my page, create cookie trafficType=testing, revisit the page than it works correctly, but if i test it with sitespeed passing cookie trafficType=testing, it does not work, though cookie is shown in in All Request Headers https://puu.sh/DzOA6/acdc29cf7e.png

What am i doing wrong ?

@soulgalore
Copy link
Member

Hi @gety9 I'm not sure. First I thought it could be something wrong with how we add a cookie today. We use web extension to do it (both for Chrome and Firefox). But for Chrome we could use the ChromeDevtoolsProtol instead.

What about trying to create a really simple test case and we can work from that? Any change you could help me with that?

Best
Peter

@gety9
Copy link
Author

gety9 commented Jun 1, 2019

@soulgalore

Hi there, we've created 3 cookie detections pages (js inline, js in header, js in footer) all of them detected sitespeed cookie. So seems like the problem either with GTM or with somethings else on our side...

I will close it for now, will reopen if something.

If you need detection pages i can share them, but the problem is not in sitespeed.

@gety9 gety9 closed this as completed Jun 1, 2019
@gety9 gety9 reopened this Jun 12, 2019
@gety9
Copy link
Author

gety9 commented Jun 12, 2019

@soulgalore

We are still trying to solve the issue.

Upon investigation we realized that

1 All Desktop Tests with cookie is correctly identified as testing (GA ID is changing to testing)
Mobile Tests Apple iPhone is correctly identified as testing (GA ID is changing to testing)
2 Only Mobile Tests Google Nexus 5 is not identified as testing (GA ID is NOT changing to testing)

Here are Jun 1 - Jun 11 stats from
Real GA (it should be 0), but it show 266 and 248 sessions
https://puu.sh/DF3LW/f1714822bf.png
Test GA (all tests show go here, and seems like the do, but where 266 and 248 are coming from ? )
https://puu.sh/DF3MG/916c5b4f00.png

So seems like the problem is with Mobile Traffic Google Nexus 5.
But what is it ? We using exactly same run command for mobile tests, an seems like all have user agent as
Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1
And why have problem with not all the tests (~650), but only with ~250.

Mobile Test

Executing 'docker run --shm-size=1g --network=3g --rm     -e TZ=America/New_York     -v /usr/share/zoneinfo/America/New_York:/etc/localtime:ro     -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:8.2.2-plus1 --browsertime.iterations 5  --browsertime.cookie trafficType=testing  --grafana.host XX.XXX.XX.XXX  --grafana.port 80  --grafana.auth XXXXXXXXXXXXXXXXXXXXXXXXXXXXX==  --graphite.host XX.XXX.XX.XXX  --graphite.port 2003  --graphite.auth runner:XXXXXXXXXXXXXXX  --graphite.annotationScreenshot true  --graphite.namespace sitespeed_io.ohio  --s3.key XXXXXXXXXXXXXXXXXXXXXX  --s3.secret XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  --s3.bucketname mystorageoh  --s3.region us-east-2  --s3.removeLocalResult true  --chrome.timeline true  --resultBaseURL http://mystorageoh.s3-website.us-east-2.amazonaws.com  --mobile true  --connectivity 3g https://www.mydomain.com/'
b'Google Chrome XX.X.XXXX.XX \nMozilla Firefox 65.0\n[2019-06-12 02:01:40] INFO: Versions OS: linux 4.15.0-1040-aws nodejs: v10.13.0 sitespeed.io: 8.2.2 browsertime: 4.2.4 coach: 3.2.0\n[2019-06-12 02:01:42] INFO: Will run Lighthouse tests after Browsertime has finished\n[2019-06-12 02:01:42] INFO: Sending url https://www.mydomain.com/ to test on Page Speed Insights\n[2019-06-12 02:01:42] INFO: Running tests using Chrome - 5 iteration(s)\n[2019-06-12 02:01:44] INFO: Testing url https://www.mydomain.com/ iteration 1\n[2019-06-12 02:01:47] INFO: Got https://www.mydomain.com/ analysed from Google Page Speed Insights\n[2019-06-12 02:02:22] INFO: https://www.mydomain.com/ BackEndTime: 985 DomInteractiveTime: 1980 DomContentLoadedTime: 1980 FirstPaint: 1310 PageLoadTime: 6335\n[2019-06-12 02:02:22] INFO: VisualMetrics FirstVisualChange: 1334 SpeedIndex: 1553 PerceptualSpeedIndex: 1618 LastVisualChange: 6800\n[2019-06-12 02:02:23] INFO: Testing url https://www.mydomain.com/ iteration 2\n[2019-06-12 02:02:57] INFO: https://www.mydomain.com/ BackEndTime: 1189 DomInteractiveTime: 2149 DomContentLoadedTime: 2149 FirstPaint: 1518 PageLoadTime: 6345\n[2019-06-12 02:02:57] INFO: VisualMetrics FirstVisualChange: 1533 SpeedIndex: 1774 PerceptualSpeedIndex: 1840 LastVisualChange: 6833\n[2019-06-12 02:02:58] INFO: Testing url https://www.mydomain.com/ iteration 3\n[2019-06-12 02:03:38] INFO: https://www.mydomain.com/ BackEndTime: 1192 DomInteractiveTime: 2193 DomContentLoadedTime: 2193 FirstPaint: 1531 PageLoadTime: 6509\n[2019-06-12 02:03:38] INFO: VisualMetrics FirstVisualChange: 1533 SpeedIndex: 1772 PerceptualSpeedIndex: 1820 LastVisualChange: 9833\n[2019-06-12 02:03:39] INFO: Testing url https://www.mydomain.com/ iteration 4\n[2019-06-12 02:04:14] INFO: https://www.mydomain.com/ BackEndTime: 1170 DomInteractiveTime: 2114 DomContentLoadedTime: 2115 FirstPaint: 1491 PageLoadTime: 6511\n[2019-06-12 02:04:14] INFO: VisualMetrics FirstVisualChange: 1500 SpeedIndex: 1743 PerceptualSpeedIndex: 1807 LastVisualChange: 6967\n[2019-06-12 02:04:15] INFO: Testing url https://www.mydomain.com/ iteration 5\n[2019-06-12 02:04:52] INFO: https://www.mydomain.com/ BackEndTime: 1134 DomInteractiveTime: 2102 DomContentLoadedTime: 2102 FirstPaint: 1470 PageLoadTime: 6440\n[2019-06-12 02:04:52] INFO: VisualMetrics FirstVisualChange: 1467 SpeedIndex: 1720 PerceptualSpeedIndex: 1781 LastVisualChange: 6900\n[2019-06-12 02:04:52] INFO: https://www.mydomain.com/ 35 requests, 631.82 kb, backEndTime: 1.13s (\xc2\xb134.58ms), firstPaint: 1.46s (\xc2\xb135.71ms), firstVisualChange: 1.47s (\xc2\xb133.04ms), DOMContentLoaded: 2.11s (\xc2\xb131.86ms), Load: 6.43s (\xc2\xb134.14ms), speedIndex: 1712 (\xc2\xb136.74), visualComplete85: 1.63s (\xc2\xb138.83ms), lastVisualChange: 7.47s (\xc2\xb1529.77ms), rumSpeedIndex: 2748 (\xc2\xb146.43) (5 runs)\n[2019-06-12 02:04:52] INFO: Will collect Lighthouse metrics for https://www.mydomain.com/\n[2019-06-12 02:05:06] INFO: Got Lighthouse metrics\n[2019-06-12 02:05:08] INFO: HTML stored in /sitespeed.io/sitespeed-result/www.mydomain.com/2019-06-12-02-01-40\n[2019-06-12 02:05:08] INFO: Uploading /sitespeed.io/sitespeed-result/www.mydomain.com/2019-06-12-02-01-40 to S3 bucket mystorageoh, this can take a while ...\n[2019-06-12 02:06:20] INFO: Finished upload to s3\n[2019-06-12 02:06:20] INFO: Find the result at http://mystorageoh.s3-website.us-east-2.amazonaws.com/www.mydomain.com/2019-06-12-02-01-40\n'

Desktop Test

Executing 'docker run --shm-size=1g --network=cable --rm     -e TZ=America/New_York     -v /usr/share/zoneinfo/America/New_York:/etc/localtime:ro     -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:8.2.2-plus1 --browsertime.iterations 5  --browsertime.cookie trafficType=testing  --grafana.host XX.XXX.XX.XXX  --grafana.port 80  --grafana.auth XXXXXXXXXXXXXXXXXXXXXXXXXXXXX==  --graphite.host XX.XXX.XX.XXX  --graphite.port 2003  --graphite.auth runner:XXXXXXXXXXXXXXX  --graphite.annotationScreenshot true  --graphite.namespace sitespeed_io.ohio  --s3.key XXXXXXXXXXXXXXXXXXXXXX  --s3.secret XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  --s3.bucketname mystorageoh  --s3.region us-east-2  --s3.removeLocalResult true  --chrome.timeline true  --resultBaseURL http://mystorageoh.s3-website.us-east-2.amazonaws.com  --mobile false  --connectivity cable https://www.mydomain.com/'
b'Google Chrome XX.X.XXXX.XX \nMozilla Firefox 65.0\n[2019-06-12 02:16:28] INFO: Versions OS: linux 4.15.0-1040-aws nodejs: v10.13.0 sitespeed.io: 8.2.2 browsertime: 4.2.4 coach: 3.2.0\n[2019-06-12 02:16:29] INFO: Will run Lighthouse tests after Browsertime has finished\n[2019-06-12 02:16:29] INFO: Sending url https://www.mydomain.com/ to test on Page Speed Insights\n[2019-06-12 02:16:29] INFO: Running tests using Chrome - 5 iteration(s)\n[2019-06-12 02:16:30] INFO: Testing url https://www.mydomain.com/ iteration 1\n[2019-06-12 02:16:33] INFO: Got https://www.mydomain.com/ analysed from Google Page Speed Insights\n[2019-06-12 02:16:52] INFO: https://www.mydomain.com/ BackEndTime: 305 DomInteractiveTime: 724 DomContentLoadedTime: 724 FirstPaint: 530 PageLoadTime: 1712\n[2019-06-12 02:16:52] INFO: VisualMetrics FirstVisualChange: 533 SpeedIndex: 757 PerceptualSpeedIndex: 797 LastVisualChange: 1233\n[2019-06-12 02:16:53] INFO: Testing url https://www.mydomain.com/ iteration 2\n[2019-06-12 02:17:15] INFO: https://www.mydomain.com/ BackEndTime: 371 DomInteractiveTime: 803 DomContentLoadedTime: 803 FirstPaint: 581 PageLoadTime: 1741\n[2019-06-12 02:17:15] INFO: VisualMetrics FirstVisualChange: 600 SpeedIndex: 689 PerceptualSpeedIndex: 767 LastVisualChange: 1233\n[2019-06-12 02:17:16] INFO: Testing url https://www.mydomain.com/ iteration 3\n[2019-06-12 02:17:38] INFO: https://www.mydomain.com/ BackEndTime: 300 DomInteractiveTime: 722 DomContentLoadedTime: 722 FirstPaint: 525 PageLoadTime: 1718\n[2019-06-12 02:17:38] INFO: VisualMetrics FirstVisualChange: 533 SpeedIndex: 752 PerceptualSpeedIndex: 790 LastVisualChange: 1200\n[2019-06-12 02:17:39] INFO: Testing url https://www.mydomain.com/ iteration 4\n[2019-06-12 02:18:01] INFO: https://www.mydomain.com/ BackEndTime: 384 DomInteractiveTime: 818 DomContentLoadedTime: 818 FirstPaint: 624 PageLoadTime: 1801\n[2019-06-12 02:18:01] INFO: VisualMetrics FirstVisualChange: 633 SpeedIndex: 852 PerceptualSpeedIndex: 887 LastVisualChange: 1300\n[2019-06-12 02:18:02] INFO: Testing url https://www.mydomain.com/ iteration 5\n[2019-06-12 02:18:24] INFO: https://www.mydomain.com/ BackEndTime: 320 DomInteractiveTime: 751 DomContentLoadedTime: 751 FirstPaint: 560 PageLoadTime: 1684\n[2019-06-12 02:18:24] INFO: VisualMetrics FirstVisualChange: 566 SpeedIndex: 785 PerceptualSpeedIndex: 823 LastVisualChange: 1233\n[2019-06-12 02:18:24] INFO: https://www.mydomain.com/ 49 requests, 750.20 kb, backEndTime: 336ms (\xc2\xb115.55ms), firstPaint: 564ms (\xc2\xb116.23ms), firstVisualChange: 573ms (\xc2\xb117.41ms), DOMContentLoaded: 764ms (\xc2\xb117.85ms), Load: 1.73s (\xc2\xb117.59ms), speedIndex: 767 (\xc2\xb123.63), visualComplete85: 807ms (\xc2\xb128.89ms), lastVisualChange: 1.24s (\xc2\xb114.62ms), rumSpeedIndex: 1153 (\xc2\xb116.10) (5 runs)\n[2019-06-12 02:18:24] INFO: Will collect Lighthouse metrics for https://www.mydomain.com/\n[2019-06-12 02:18:32] INFO: Got Lighthouse metrics\n[2019-06-12 02:18:33] INFO: HTML stored in /sitespeed.io/sitespeed-result/www.mydomain.com/2019-06-12-02-16-28\n[2019-06-12 02:18:33] INFO: Uploading /sitespeed.io/sitespeed-result/www.mydomain.com/2019-06-12-02-16-28 to S3 bucket mystorageoh, this can take a while ...\n[2019-06-12 02:18:35] INFO: Finished upload to s3\n[2019-06-12 02:18:35] INFO: Find the result at http://mystorageoh.s3-website.us-east-2.amazonaws.com/www.mydomain.com/2019-06-12-02-16-28\n'

Do you have any ideas ?

One more time we are using the following script to identify cookie and change the GA ID.

function(){
  if(!({{Traffic type _cookies}}=='testing')){
    	return {{Google Analytics ID}};
	}else{
  		return 'UA-00000000-0';
	}
}

@soulgalore
Copy link
Member

Hi @gety9 ok I see, the reason is that WebExtension (that we use to set the cookie) doesn't work on mobile phones (Chrome doesn't support it). What you can do right now is to use https://www.sitespeed.io/documentation/sitespeed.io/scripting/ and run Chrome Devtools Protocol commands.

Checkout https://chromedevtools.github.io/devtools-protocol/tot/Network#method-setCookie. It could be that you first need to enable network by using https://chromedevtools.github.io/devtools-protocol/tot/Network#method-enable, I don't remember.

Have you used CDP before? If not let me know if you need any help.

Best
Peter

@soulgalore
Copy link
Member

In the long term I planned to add a short cut for setting the cookie that way, but I haven't had the time to focus on that yet, sorry!

@gety9
Copy link
Author

gety9 commented Jun 12, 2019

@soulgalore

"the reason is that WebExtension (that we use to set the cookie) doesn't work on mobile phones (Chrome doesn't support it)"
-could you explain why it works sometimes ?
it's not all (~650) mobile visits which are landed in real GA, but only ~250.
Just trying to understand how things work.

"Have you used CDP before? If not let me know if you need any help."
-Nope, but it will be similar to this, right ? #2267 (comment)

@soulgalore
Copy link
Member

Ah sorry I miss read your comment. I was of the impression that it works for you on desktop and running emulated mobile, but when testing on a real Android phone, it never works?

@soulgalore
Copy link
Member

@gety9 how do you run your tests? I've found one bug now when I was fixing another bug: If you run a script and don't navigate by a URL, (command.measure.start('alias'), the Browser Extension doesn't run (so no cookie is set). I'll try to fix that asap.

@soulgalore
Copy link
Member

Hmm that isn't super easy to fix, I'll created a bug for it here: sitespeedio/browsertime#859

@gety9
Copy link
Author

gety9 commented Jun 13, 2019

@soulgalore

how do you run your tests?

the run for tests is always the same:

docker run --shm-size=1g --network=3g --rm -e TZ=America/New_York -v /usr/share/zoneinfo/America/New_York:/etc/localtime:ro -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:8.2.2-plus1 --browsertime.iterations 5 --browsertime.cookie trafficType=testing --grafana.host XX.XXX.XX.XXX --grafana.port 80 --grafana.auth XXXXXXXXXXXXXXXXXXXXXXXXXXXXX== --graphite.host XX.XXX.XX.XXX --graphite.port 2003 --graphite.auth runner:XXXXXXXXXXXXXXX --graphite.annotationScreenshot true --graphite.namespace sitespeed_io.ohio --s3.key XXXXXXXXXXXXXXXXXXXXXX --s3.secret XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --s3.bucketname mystorageoh --s3.region us-east-2 --s3.removeLocalResult true --chrome.timeline true --resultBaseURL http://mystorageoh.s3-website.us-east-2.amazonaws.com --mobile true --connectivity 3g https://www.mydomain.com/

And we always use same script (inside google analytics, not inside sitespeed) to change google analytic ID

function(){
  if(!({{Traffic type _cookies}}=='testing')){
    	return {{Google Analytics ID}};
	}else{
  		return 'UA-00000000-0';
	}
}

The problem is that though Google Analytics ID is changed to testing, in 40% of tests it also is landed in real Google Analytics. https://puu.sh/DFo6N/f50b8d444a.png
This problem is present only for --mobile true --connectivity 3g tests.
All --mobile false --connectivity cable work correctly and 0% of traffic is landed in real Google Analytics.

@soulgalore
Copy link
Member

Ok, then I understand. Hmm, so somehow then when running on 3g the cookie aren't set correctly?

@gety9
Copy link
Author

gety9 commented Jun 13, 2019

@soulgalore

yes, the problem is either --mobile true OR --connectivity 3g
seems like the cookie is set (cause the traffic is landing in testing GA too), but either it's set too slow (which is not possible i think) or somehow there are 2 visits.

What i mean if we do 100 mobile tests,
it's not that 60 go to test GA and 40 go to real GA
it's that 100 go test GA, but 40 go to real GA.
So i am trying to understand how it's possible.

@gety9
Copy link
Author

gety9 commented Jun 13, 2019

@soulgalore

could you explain me how --mobile true and --connectivity 3g work ?
I will ask javascript guys maybe there is some explanation for it.

@soulgalore
Copy link
Member

--mobile true

Turn on Chrome in emulated mobile. Checkout

// set mobile options
if (options.mobile) {
btOptions.viewPort = '360x640';
if (btOptions.browser === 'chrome') {
const emulation = get(
btOptions,
'chrome.mobileEmulation.deviceName',
'iPhone 6'
);
btOptions.chrome.mobileEmulation = {
deviceName: emulation
};
} else {
btOptions.userAgent = iphone6UserAgent;
}
}

--connectivity 3g

Add the string 3g as the name of the connectivity. Nothing else is set if you use Docker networks. If you use Throttle as connectivity engine, then it sets up the correct tc config for the network.

@gety9
Copy link
Author

gety9 commented Jun 14, 2019

@soulgalore

Managed to get userAgent for this "double serving" visit for which cookie does not work, it is:
Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3559.0 Mobile Safari/537.36

Doing google search i came to
GoogleChrome/lighthouse#6814
GoogleChrome/lighthouse#7009 (comment)

So seems like it's lighthouse visit, and i can assume that cookies do not work for lighthouse in emulated or throttled mode.

Here is there is cookie related issue
GoogleChrome/lighthouse#9178
(but not sure it's what we have here)

@soulgalore
Copy link
Member

Aha I see. If you set a cookie for browsertime we don't automatically set that for Lighthouse/GPSI/WebPageTest or whatever other tool you use. Sorry I missed that you are using the plus1 container.

@gety9
Copy link
Author

gety9 commented Jun 14, 2019

@soulgalore

ok, understood

How can i set the cookie to Lighthouse ? Is there a parameter so something i can add to the run that we use now ?

docker run --shm-size=1g --network=3g --rm -e TZ=America/New_York -v /usr/share/zoneinfo/America/New_York:/etc/localtime:ro -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:8.2.2-plus1 --browsertime.iterations 5 --browsertime.cookie trafficType=testing --grafana.host XX.XXX.XX.XXX --grafana.port 80 --grafana.auth XXXXXXXXXXXXXXXXXXXXXXXXXXXXX== --graphite.host XX.XXX.XX.XXX --graphite.port 2003 --graphite.auth runner:XXXXXXXXXXXXXXX --graphite.annotationScreenshot true --graphite.namespace sitespeed_io.ohio --s3.key XXXXXXXXXXXXXXXXXXXXXX --s3.secret XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --s3.bucketname mystorageoh --s3.region us-east-2 --s3.removeLocalResult true --chrome.timeline true --resultBaseURL http://mystorageoh.s3-website.us-east-2.amazonaws.com --mobile true --connectivity 3g https://www.mydomain.com/

@soulgalore
Copy link
Member

I think you can set headers with Lighthouse, check their docs. Parameters in the namespace --lighthouse.settings.* is passed on to Lighthouse, check https://github.com/sitespeedio/plugin-lighthouse#configuration

@gety9
Copy link
Author

gety9 commented Jun 15, 2019

@soulgalore

i see, thank you

I've added this to json config file

    "lighthouse": {
      "settings.extra-headers": "{\"Cookie\":\"trafficType=testing\"}"
    },

which added this to run command

--lighthouse.settings.extra-headers {"Cookie":"trafficType=testing"}

let's see if it will fix it.

Also why did we had this problem only with mobile tests (--mobile true --connectivity 3g) ?
We were not passing lighthouse cookie for desktop tests (--mobile false --connectivity cable) too. Why they did not show up in real GA ?

UPDATE:
Still not working, it's because of LH bug which they are still working on.
GoogleChrome/lighthouse#9178

@soulgalore
Copy link
Member

soulgalore commented Jun 15, 2019

Yeah try something like that. It could also be extraHeaders think the doc isn't clear. You can test on httpbin just to get it right: https://httpbin.org/#/Request_inspection/get_headers

@soulgalore
Copy link
Member

Closing since it was a Lighthouse issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants