mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Add google analytics to installer
This commit is contained in:
parent
2487e34ee8
commit
2fe9f6df6f
4 changed files with 141 additions and 18 deletions
|
@ -17,6 +17,8 @@ To produce an executable installer on Windows, the following are required:
|
||||||
- [Nullsoft Scriptable Install System](http://nsis.sourceforge.net/Download) - 3.0b3
|
- [Nullsoft Scriptable Install System](http://nsis.sourceforge.net/Download) - 3.0b3
|
||||||
- [UAC Plug-in for Nullsoft](http://nsis.sourceforge.net/UAC_plug-in) - 0.2.4c
|
- [UAC Plug-in for Nullsoft](http://nsis.sourceforge.net/UAC_plug-in) - 0.2.4c
|
||||||
- [nsProcess Plug-in for Nullsoft](http://nsis.sourceforge.net/NsProcess_plugin) - 1.6
|
- [nsProcess Plug-in for Nullsoft](http://nsis.sourceforge.net/NsProcess_plugin) - 1.6
|
||||||
|
- [Inetc Plug-in for Nullsoft](http://nsis.sourceforge.net/Inetc_plug-in) - 1.0
|
||||||
|
- [NSISpcre Plug-in for Nullsoft](http://nsis.sourceforge.net/NSISpcre_plug-in) - 1.0
|
||||||
|
|
||||||
Run the `package` target to create an executable installer using the Nullsoft Scriptable Install System.
|
Run the `package` target to create an executable installer using the Nullsoft Scriptable Install System.
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,7 @@ macro(SET_PACKAGING_PARAMETERS)
|
||||||
set(CLIENT_LAUNCH_NOW_REG_KEY "ClientLaunchAfterInstall")
|
set(CLIENT_LAUNCH_NOW_REG_KEY "ClientLaunchAfterInstall")
|
||||||
set(SERVER_LAUNCH_NOW_REG_KEY "ServerLaunchAfterInstall")
|
set(SERVER_LAUNCH_NOW_REG_KEY "ServerLaunchAfterInstall")
|
||||||
set(CUSTOM_INSTALL_REG_KEY "CustomInstall")
|
set(CUSTOM_INSTALL_REG_KEY "CustomInstall")
|
||||||
|
set(CLIENT_ID_REG_KEY "ClientGUID")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# setup component categories for installer
|
# setup component categories for installer
|
||||||
|
|
|
@ -41,6 +41,8 @@ set(CONSOLE_STARTUP_REG_KEY "@CONSOLE_STARTUP_REG_KEY@")
|
||||||
set(SERVER_LAUNCH_NOW_REG_KEY "@SERVER_LAUNCH_NOW_REG_KEY@")
|
set(SERVER_LAUNCH_NOW_REG_KEY "@SERVER_LAUNCH_NOW_REG_KEY@")
|
||||||
set(CLIENT_LAUNCH_NOW_REG_KEY "@CLIENT_LAUNCH_NOW_REG_KEY@")
|
set(CLIENT_LAUNCH_NOW_REG_KEY "@CLIENT_LAUNCH_NOW_REG_KEY@")
|
||||||
set(CUSTOM_INSTALL_REG_KEY "@CUSTOM_INSTALL_REG_KEY@")
|
set(CUSTOM_INSTALL_REG_KEY "@CUSTOM_INSTALL_REG_KEY@")
|
||||||
|
set(GA_TRACKING_ID "@GA_TRACKING_ID@")
|
||||||
|
set(CLIENT_ID_REG_KEY "@CLIENT_ID_REG_KEY@")
|
||||||
set(INSTALLER_HEADER_IMAGE "@INSTALLER_HEADER_IMAGE@")
|
set(INSTALLER_HEADER_IMAGE "@INSTALLER_HEADER_IMAGE@")
|
||||||
set(UNINSTALLER_HEADER_IMAGE "@UNINSTALLER_HEADER_IMAGE@")
|
set(UNINSTALLER_HEADER_IMAGE "@UNINSTALLER_HEADER_IMAGE@")
|
||||||
set(ADD_REMOVE_ICON_PATH "@ADD_REMOVE_ICON_PATH@")
|
set(ADD_REMOVE_ICON_PATH "@ADD_REMOVE_ICON_PATH@")
|
||||||
|
|
|
@ -319,6 +319,87 @@ Function DownloadFile
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
|
||||||
|
!include NSISpcre.nsh
|
||||||
|
!insertmacro REMatches
|
||||||
|
|
||||||
|
Var CampaignName
|
||||||
|
|
||||||
|
!macro GetCampaignName RetVar
|
||||||
|
Call GetCampaignName
|
||||||
|
Pop ${RetVar}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
Function GetCampaignName
|
||||||
|
Push $0 ; Stash $0
|
||||||
|
|
||||||
|
; Parse filename out of the path
|
||||||
|
${RECaptureMatches} $0 "([^\\]*\\)*(.*)\.exe" $EXEPATH 0
|
||||||
|
${If} $0 == 2
|
||||||
|
Pop $0 ; Discard Path
|
||||||
|
Pop $0 ; Recover filename
|
||||||
|
; Parse campaign out of the filename
|
||||||
|
${RECaptureMatches} $0 "HighFidelity-([^-]*-)Beta-.*" $0 0
|
||||||
|
${If} $0 == 1
|
||||||
|
Pop $0 ; Recover campaign name
|
||||||
|
StrCpy $0 $0 -1 0 ; Remove trailing - and copy to _RetVar
|
||||||
|
${Else}
|
||||||
|
StrCpy $0 ""
|
||||||
|
${EndIf}
|
||||||
|
${Else}
|
||||||
|
StrCpy $0 ""
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
Exch $0 ; Restore $0 and push result
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
!macro CreateGUID RetVar
|
||||||
|
System::Call 'ole32::CoCreateGuid(g .s)'
|
||||||
|
Pop ${RetVar}
|
||||||
|
; Strip opening and closing braces
|
||||||
|
StrCpy ${RetVar} ${RetVar} -1 1
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
Var GAClientID
|
||||||
|
|
||||||
|
!macro InitGAClientID
|
||||||
|
; Generate a new GUID on every run for now
|
||||||
|
!insertmacro CreateGUID $GAClientID
|
||||||
|
|
||||||
|
; Push $0
|
||||||
|
; ReadRegStr $GAClientID HKLM "@REGISTRY_HKLM_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "@CLIENT_ID_REG_KEY@"
|
||||||
|
; ${REMatches} $0 "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}" $GAClientID 0
|
||||||
|
; ${If} $0 == false
|
||||||
|
; !insertmacro CreateGUID $GAClientID
|
||||||
|
; WriteRegStr HKLM "@REGISTRY_HKLM_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "@CLIENT_ID_REG_KEY@" $GAClientID
|
||||||
|
; ${EndIf}
|
||||||
|
; Pop $0
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!macro GoogleAnalytics Category Action Label Value
|
||||||
|
${If} "@GA_TRACKING_ID@" != ""
|
||||||
|
Push $0
|
||||||
|
Push $1
|
||||||
|
|
||||||
|
StrCpy $0 "https://google-analytics.com/collect?v=1&tid=@GA_TRACKING_ID@"
|
||||||
|
StrCpy $0 "$0&cid=$GAClientID&t=event&ec=${Category}&ea=${Action}"
|
||||||
|
|
||||||
|
${If} "${Label}" != ""
|
||||||
|
StrCpy $0 "$0&el=${Label}"
|
||||||
|
${EndIf}
|
||||||
|
${If} "${Value}" != ""
|
||||||
|
StrCpy $0 "$0&ev=${Value}"
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
GetTempFileName $1
|
||||||
|
inetc::get /SILENT $0 $1 /END
|
||||||
|
Delete $1
|
||||||
|
|
||||||
|
Pop $1
|
||||||
|
Pop $0
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
; Installation types
|
; Installation types
|
||||||
|
|
||||||
|
@ -342,28 +423,32 @@ SectionEnd
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Pages
|
;Pages
|
||||||
|
!define MUI_CUSTOMFUNCTION_ABORT OnUserAbort
|
||||||
|
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE PageWelcomePre
|
||||||
!insertmacro MUI_PAGE_WELCOME
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
|
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE PageLicensePre
|
||||||
!insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
|
!insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
|
||||||
|
|
||||||
Page custom InstallTypesPage ReadInstallTypes
|
Page custom InstallTypesPage ReadInstallTypes
|
||||||
|
|
||||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE AbortFunction
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
|
||||||
!insertmacro MUI_PAGE_DIRECTORY
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
|
|
||||||
;Start Menu Folder Page Configuration
|
;Start Menu Folder Page Configuration
|
||||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
|
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE PageStartMenuPre
|
||||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE AbortFunction
|
|
||||||
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
|
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
|
||||||
|
|
||||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE AbortFunction
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE PageComponentsPre
|
||||||
@CPACK_NSIS_PAGE_COMPONENTS@
|
@CPACK_NSIS_PAGE_COMPONENTS@
|
||||||
|
|
||||||
Page custom PostInstallOptionsPage ReadPostInstallOptions
|
Page custom PostInstallOptionsPage ReadPostInstallOptions
|
||||||
|
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE PageInstallFilesPre
|
||||||
!insertmacro MUI_PAGE_INSTFILES
|
!insertmacro MUI_PAGE_INSTFILES
|
||||||
|
|
||||||
!insertmacro MUI_UNPAGE_CONFIRM
|
!insertmacro MUI_UNPAGE_CONFIRM
|
||||||
|
@ -452,8 +537,40 @@ Var CopyFromProductionCheckbox
|
||||||
Var ExpressInstallRadioButton
|
Var ExpressInstallRadioButton
|
||||||
Var CustomInstallRadioButton
|
Var CustomInstallRadioButton
|
||||||
Var InstallTypeDialog
|
Var InstallTypeDialog
|
||||||
Var Express
|
|
||||||
Var CustomInstallTemporaryState
|
Var CustomInstallTemporaryState
|
||||||
|
Var Express
|
||||||
|
|
||||||
|
!macro MaybeSkipPage
|
||||||
|
; Check if Express is set, if so, abort the post install options page
|
||||||
|
${If} $Express == "1"
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
Function OnUserAbort
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "Abort" "User Abort" ""
|
||||||
|
FunctionEnd
|
||||||
|
Function PageWelcomePre
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "Welcome" "" ""
|
||||||
|
FunctionEnd
|
||||||
|
Function PageLicensePre
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "License" "" ""
|
||||||
|
FunctionEnd
|
||||||
|
Function PageDirectoryPre
|
||||||
|
!insertmacro MaybeSkipPage
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "Directory" "" ""
|
||||||
|
FunctionEnd
|
||||||
|
Function PageStartMenuPre
|
||||||
|
!insertmacro MaybeSkipPage
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "StartMenu" "" ""
|
||||||
|
FunctionEnd
|
||||||
|
Function PageComponentsPre
|
||||||
|
!insertmacro MaybeSkipPage
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "Components" "" ""
|
||||||
|
FunctionEnd
|
||||||
|
Function PageInstallFilesPre
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "Install" "" ""
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
!macro SetInstallOption Checkbox OptionName Default
|
!macro SetInstallOption Checkbox OptionName Default
|
||||||
; reads the value for the given install option to the registry
|
; reads the value for the given install option to the registry
|
||||||
|
@ -472,6 +589,8 @@ Var CustomInstallTemporaryState
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
Function InstallTypesPage
|
Function InstallTypesPage
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "Install Types" "" ""
|
||||||
|
|
||||||
!insertmacro MUI_HEADER_TEXT "Choose Installation Type" "Express or Custom Install"
|
!insertmacro MUI_HEADER_TEXT "Choose Installation Type" "Express or Custom Install"
|
||||||
|
|
||||||
nsDialogs::Create 1018
|
nsDialogs::Create 1018
|
||||||
|
@ -523,14 +642,10 @@ Function ChangeCustomLabel
|
||||||
Pop $R1
|
Pop $R1
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function AbortFunction
|
|
||||||
; Check if Express is set, if so, abort the post install options page
|
|
||||||
StrCmp $Express "1" 0 end
|
|
||||||
Abort
|
|
||||||
end:
|
|
||||||
FunctionEnd
|
|
||||||
|
|
||||||
Function PostInstallOptionsPage
|
Function PostInstallOptionsPage
|
||||||
|
!insertmacro MaybeSkipPage
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "Post Install Options" "" ""
|
||||||
|
|
||||||
!insertmacro MUI_HEADER_TEXT "Setup Options" ""
|
!insertmacro MUI_HEADER_TEXT "Setup Options" ""
|
||||||
|
|
||||||
nsDialogs::Create 1018
|
nsDialogs::Create 1018
|
||||||
|
@ -540,11 +655,6 @@ Function PostInstallOptionsPage
|
||||||
Abort
|
Abort
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
; Check if Express is set, if so, abort the post install options page
|
|
||||||
StrCmp $Express "1" 0 end
|
|
||||||
Abort
|
|
||||||
end:
|
|
||||||
|
|
||||||
StrCpy $CurrentOffset 0
|
StrCpy $CurrentOffset 0
|
||||||
StrCpy $OffsetUnits u
|
StrCpy $OffsetUnits u
|
||||||
|
|
||||||
|
@ -965,6 +1075,7 @@ Section "-Core installation"
|
||||||
; Handle whichever post install options were set
|
; Handle whichever post install options were set
|
||||||
Call HandlePostInstallOptions
|
Call HandlePostInstallOptions
|
||||||
|
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "Done" "" ""
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
!include nsProcess.nsh
|
!include nsProcess.nsh
|
||||||
|
@ -992,6 +1103,8 @@ SectionEnd
|
||||||
/SD IDCANCEL IDRETRY Prompt_${UniqueID} IDCANCEL 0
|
/SD IDCANCEL IDRETRY Prompt_${UniqueID} IDCANCEL 0
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "Abort" "AppRunning" "${displayName}"
|
||||||
|
|
||||||
; If the user decided to cancel, stop the current installer/uninstaller
|
; If the user decided to cancel, stop the current installer/uninstaller
|
||||||
Abort
|
Abort
|
||||||
|
|
||||||
|
@ -1219,6 +1332,11 @@ Function .onInit
|
||||||
Quit
|
Quit
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
!insertmacro InitGAClientID
|
||||||
|
!insertmacro GetCampaignName $CampaignName
|
||||||
|
|
||||||
|
!insertmacro GoogleAnalytics "Installer" "Start" "$CampaignName" ""
|
||||||
|
|
||||||
; make sure none of the installed applications are still running
|
; make sure none of the installed applications are still running
|
||||||
!insertmacro CheckForRunningApplications "installed" "Installer"
|
!insertmacro CheckForRunningApplications "installed" "Installer"
|
||||||
${nsProcess::Unload}
|
${nsProcess::Unload}
|
||||||
|
|
Loading…
Reference in a new issue