remove trailing slashes from analytics paths
This commit is contained in:
parent
ede1c5e623
commit
b19325b675
1 changed files with 6 additions and 1 deletions
|
@ -27,9 +27,14 @@ instance FromJSON MRResult where
|
|||
parseMetricsResponse :: MetricsResponse -> Either String (Map String Int)
|
||||
parseMetricsResponse MetricsResponse { results = r } = Map.fromList <$> mapM parseResult r
|
||||
where parseResult :: MRResult -> Either String (String, Int)
|
||||
parseResult MRResult { metrics = [count], dimensions = [path] } = Right (path, count)
|
||||
parseResult MRResult { metrics = [count], dimensions = [path] }
|
||||
= Right (parsePagePath path, count)
|
||||
parseResult result = Left $ "Could not parse result: " ++ show result
|
||||
|
||||
parsePagePath [] = []
|
||||
parsePagePath "/" = []
|
||||
parsePagePath (x:xs) = x:parsePagePath xs;
|
||||
|
||||
queryPageviews :: C.Config -> IO (Either String (Map String Int))
|
||||
queryPageviews config = do
|
||||
request' <- H.parseRequest $ "POST " ++ C.queryUrl (C.plausible config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue