@@ -69,33 +69,33 @@ extension SurveyViewController {
6969 case orderFormShippingLines
7070
7171 fileprivate var url : URL {
72- switch self {
73- case . inAppFeedback :
74- return WooConstants . URLs . inAppFeedback
75- . asURL ( )
76- . tagPlatform ( " ios " )
77- . tagAppVersion ( Bundle . main . bundleVersion ( ) )
78- case . productsFeedback:
79- return WooConstants . URLs . productsFeedback
80- . asURL ( )
81- . tagPlatform ( " ios " )
82- . tagAppVersion ( Bundle . main . bundleVersion ( ) )
83- case . addOnsI1 :
84- return WooConstants . URLs. orderAddOnI1Feedback
85- . asURL ( )
86- . tagPlatform ( " ios " )
87- . tagAppVersion ( Bundle . main . bundleVersion ( ) )
88- case . orderCreation :
89- return WooConstants . URLs . orderCreationFeedback
90- . asURL ( )
91- . tagPlatform ( " ios " )
92- . tagAppVersion ( Bundle . main . bundleVersion ( ) )
93- case . orderFormShippingLines :
94- return WooConstants . URLs . orderCreationShippingFeedback
95- . asURL ( )
96- . tagPlatform ( " ios " )
97- . tagAppVersion ( Bundle . main . bundleVersion ( ) )
98- }
72+ let url : URL = {
73+ switch self {
74+ case . inAppFeedback:
75+ return WooConstants . URLs . inAppFeedback
76+ . asURL ( )
77+ case . productsFeedback :
78+ return WooConstants . URLs . productsFeedback
79+ . asURL ( )
80+ case . addOnsI1 :
81+ return WooConstants . URLs . orderAddOnI1Feedback
82+ . asURL ( )
83+ case . orderCreation :
84+ return WooConstants . URLs. orderCreationFeedback
85+ . asURL ( )
86+ case . orderFormShippingLines :
87+ return WooConstants . URLs . orderCreationShippingFeedback
88+ . asURL ( )
89+ }
90+ } ( )
91+
92+ let session = ServiceLocator . stores . sessionManager
93+ return url
94+ . tagPlatform ( " ios " )
95+ . tagAppVersion ( Bundle . main . bundleVersion ( ) )
96+ . tagSiteInfo ( siteID : session . defaultSite ? . siteID ,
97+ storeUUID : session . defaultStoreUUID ,
98+ storeURL : session . defaultSite ? . url )
9999 }
100100
101101 fileprivate var title : String {
@@ -168,6 +168,22 @@ extension URL {
168168 appendingQueryItem ( URLQueryItem ( name: Tags . surveyRequestAppVersionTag, value: version) )
169169 }
170170
171+ func tagSiteInfo( siteID: Int64 ? ,
172+ storeUUID: String ? ,
173+ storeURL: String ? ) -> URL {
174+ var url = self
175+ if let siteID = siteID {
176+ url = url. appendingQueryItem ( URLQueryItem ( name: Tags . surveyRequestSiteIdTag, value: " \( siteID) " ) )
177+ }
178+ if let storeUUID = storeUUID {
179+ url = url. appendingQueryItem ( URLQueryItem ( name: Tags . surveyRequestStoreUUIDTag, value: storeUUID) )
180+ }
181+ if let storeURL = storeURL {
182+ url = url. appendingQueryItem ( URLQueryItem ( name: Tags . surveyRequestStoreURLTag, value: storeURL) )
183+ }
184+ return url
185+ }
186+
171187 private func appendingQueryItem( _ queryItem: URLQueryItem ) -> URL {
172188 guard var urlComponents = URLComponents ( url: self , resolvingAgainstBaseURL: false ) else {
173189 assertionFailure ( " Cannot create URL components from \( self ) " )
@@ -185,6 +201,9 @@ extension URL {
185201 private enum Tags {
186202 static let surveyRequestPlatformTag = " woo-mobile-platform "
187203 static let surveyRequestAppVersionTag = " app-version "
204+ static let surveyRequestSiteIdTag = " site-id "
205+ static let surveyRequestStoreUUIDTag = " store-id "
206+ static let surveyRequestStoreURLTag = " store-url "
188207 }
189208}
190209
0 commit comments