PageSourceSearch

https://7-11.com.tw/js/gaCode.js

js 7-11.com.tw collected 2026-09-24 08:57:46 UTC 3,880 bytes, 124 lines download raw bytes

1//注意要更換 GA Code  UA-XXXX-X
2
3var userDevice = "PC";
4function isMobile() {
5    var mobiles = new Array
6    (
7        "midp", "j2me", "avant", "docomo", "novarra", "palmos", "palmsource",
8        "240x320", "opwv", "chtml", "pda", "windows ce", "mmp/",
9        "blackberry", "mib/", "symbian", "wireless", "nokia", "hand", "mobi",
10        "phone", "cdm", "up.b", "audio", "sie-", "sec-", "samsung", "htc",
11        "mot-", "mitsu", "sagem", "sony", "alcatel", "lg", "eric", "vx",
12        "NEC", "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch",
13        "rover", "pocket", "benq", "java", "pt", "pg", "vox", "amoi",
14        "bird", "compal", "kg", "voda", "sany", "kdd", "dbt", "sendo",
15        "sgh", "gradi", "jb", "dddi", "moto", "iphone", "android",
16        "ipod", "incognito", "webmate", "dream", "cupcake", "webos",
17        "s8000", "bada", "googlebot-mobile", "ipad"
18    )
19
20    var userAgent = navigator.userAgent;
21    var weburl = location.pathname + "";
22    for (var i = 0; i < mobiles.length; i++) {
23        if (userAgent.toLowerCase().indexOf(mobiles[i]) > 0) {
24            userDevice = "mobile";
25            break;
26        }
27    }
28}
29isMobile();
30
31
32// (function (i, s, o, g, r, a, m) {
33    // i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
34
35        // (i[r].q = i[r].q || []).push(arguments)
36    // }, i[r].l = 1 * new Date(); a = s.createElement(o),
37
38    // m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
39
40// })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
41
42
43
44// ga('create', 'UA-47156016-1', '7-11.com.tw');
45
46// ga('send', 'pageview');
47//GA4
48var imported = document.createElement('script');
49imported.src = 'https://www.googletagmanager.com/gtag/js?id=G-SJRNFM8FDV';
50document.head.appendChild(imported);
51
52
vendor: 133 bytes, lines 53-56
53window.dataLayer = window.dataLayer || [];
54function gtag() { dataLayer.push(arguments); }
55gtag('js', new Date());
56gtag('config', '
56G-SJRNFM8FDV
vendor: 5 bytes, line 56
56');
57gtag('config', 'UA-47156016-1');
58
59var GA_Category = "7-11官網"
60
61//gaLogOpenWin('Top Menu','A01_主題活動','http://www.yahoo.com.tw/','_blank')  
62//javascript:gaLogOpenWin('Top Menu','','','_blank');
63function gaLogOpenWin(Action, Label, url, status) {
64	//GA4
65	gtag('event', Action, {
66		  'event_category': GA_Category + "_FROM " + userDevice,
67		  'event_label': Label
68		});
69    // ga('send', 'event', GA_Category + "_FROM " + userDevice, Action, Label);
70    if (status == "_blank") {
71        window.open(url, '');
72    } else {
73        location.href = url;
74    }
75}
76//gaLog("Top Menu","A01_主題活動")  
77function gaLog(Action, Label) {
78	//GA4
79	gtag('event', Action, {
80		  'event_category': GA_Category + "_FROM " + userDevice,
81		  'event_label': Label
82		});
83    // ga('send', 'event', GA_Category + "_FROM " + userDevice, Action, Label);
84    //_gaq.push(['_trackEvent', EVENT_NAME, Action ]);
85}
86
87function gaLog_7App(Action, Label) {
88	//GA4
89	gtag('event', Action, {
90		  'event_category': GA_Category + "_FROM_7App",
91		  'event_label': Label
92		});
93    
94}
95
96function gaPVLog(page) {
97    ga('send', 'pageview');
98    //_gaq.push(['_trackPageview', page]);	
99}
100
101
102  //test Matomo
103  /*
104  var _paq = window._paq || [];
105  // tracker methods like "setCustomDimension" should be called before "trackPageView"
106  _paq.push(['trackPageView']);
107  _paq.push(['enableLinkTracking']);
108  (function() {
109    var u="https://seveneleventw.matomo.cloud/";
110    _paq.push(['setTrackerUrl', u+'matomo.php']);
111    _paq.push(['setSiteId', '1']);
112    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
113    g.type='text/javascript'; g.async=true; g.defer=true; g.src='//cdn.matomo.cloud/seveneleventw.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s);
114  })();
115  */
116
117
118
119
120
121
122
123
124

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.