This commit is contained in:
Jerome Laban 2023-06-13 07:36:20 -04:00
Родитель 038ee90608
Коммит 347f10207e
3 изменённых файлов: 61 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,7 @@
declare namespace Uno.UI.Demo {
class Analytics {
private static isLoaded;
static reportPageView(screenName: string, appName?: string): string;
private static init(screenName, appName);
}
}

Просмотреть файл

@ -0,0 +1,52 @@
var Uno;
(function (Uno) {
var UI;
(function (UI) {
var Demo;
(function (Demo) {
class Analytics {
static reportPageView(screenName, appName = "wct-wasm") {
if (Analytics.init(screenName, appName)) {
return "ok";
}
const gtag = window.gtag;
if (gtag) {
gtag("event", "screen_view", {
screen_name: screenName,
app_name: appName
});
}
else {
console.error(`Google Analytics not present, can't report page view for ${screenName}.`);
}
return "ok";
}
static init(screenName, appName) {
if (Analytics.isLoaded) {
return false;
}
const script = `
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-26688675-6');
gtag("event", "screen_view", {screen_name: \"${screenName}\", app_name: \"${appName}\"});`;
const script1 = document.createElement("script");
script1.type = "text/javascript";
script1.src = "https://www.googletagmanager.com/gtag/js?id=UA-26688675-3";
document.body.appendChild(script1);
const script2 = document.createElement("script");
script2.type = "text/javascript";
script2.innerText = script;
document.body.appendChild(script2);
Analytics.isLoaded = true;
return true;
}
}
Analytics.isLoaded = false;
Demo.Analytics = Analytics;
})(Demo = UI.Demo || (UI.Demo = {}));
})(UI = Uno.UI || (Uno.UI = {}));
})(Uno || (Uno = {}));
Uno.UI.Demo.Analytics.reportPageView("init");

Просмотреть файл

@ -27,7 +27,7 @@ steps:
allowDowngrade: true
nugetVersion: 'dev'
nugetUpdaterVersion: 2.3.0-alpha.44
packageAuthor: 'nventive,Uno Platform'
packageAuthor: 'nventive,unoplatform'
summaryFile: '$(Build.ArtifactStagingDirectory)/Canary.md'
resultFile: '$(Build.ArtifactStagingDirectory)/update_result.json'
@ -42,7 +42,7 @@ steps:
allowDowngrade: true
nugetVersion: 'feature.5x,dev'
nugetUpdaterVersion: 2.3.0-alpha.44
packageAuthor: 'nventive,Uno Platform'
packageAuthor: 'nventive,unoplatform'
summaryFile: '$(Build.ArtifactStagingDirectory)/Canary.md'
resultFile: '$(Build.ArtifactStagingDirectory)/update_result.json'
additionalPublicSources: 'https://pkgs.dev.azure.com/uno-platform/1dd81cbd-cb35-41de-a570-b0df3571a196/_packaging/dev-uno5/nuget/v3/index.json'