Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用python请求访问网站不需要';谷歌分析中的t计数_Python_Google Analytics_Python Requests - Fatal编程技术网

使用python请求访问网站不需要';谷歌分析中的t计数

使用python请求访问网站不需要';谷歌分析中的t计数,python,google-analytics,python-requests,Python,Google Analytics,Python Requests,使用python请求的网站访问不计入谷歌实时分析 我正在使用python请求模块,google统计访问次数,但在google analytics real time(活动用户)中找不到 我的代码如下: import requests import time agent_android = 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Ver

使用python请求的网站访问不计入谷歌实时分析

我正在使用python请求模块,google统计访问次数,但在google analytics real time(活动用户)中找不到

我的代码如下:

import requests
import time

agent_android = 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36'
headers = {'User-Agent': agent_android}


response = requests.get(url, headers=headers)
print(response.content)
time.sleep(300)

我建议你看一看 对于这样的目的,它是完美的。这里有一个例子:

from selenium import webdriver
import time

def main():
    url = "https:youURL.com"
    driver = webdriver.Firefox()
    driver.get(url=url)
    time.sleep(300)
    driver.quit()

if __name__ == '__main__':
    main()

我不认为requests模块会执行javascript代码,没有它,GA将无法跟踪。