diff --git a/example.hs b/example.hs
--- a/example.hs
+++ b/example.hs
@@ -16,11 +16,11 @@
     key:_ <- getArgs
     withHelics def { licenseKey = S8.pack key, appName = "Test3" } $ do
         _ <- forkIO $ sampler 20
-        run 3000 $ helics app
+        run 3000 $ helics def app
 
 app :: Application
 app req send = case pathInfo req of
     []      -> threadDelay (10^(5::Int))     >> send (responseLBS status200 [] "root")
     ["foo"] -> threadDelay (2 * 10^(5::Int)) >> send (responseLBS status200 [] "foo")
-    ["bar"] -> datastoreSegment autoScope (DatastoreSegment "bar" "select" "SELECT * FROM bar WHERE key =  'baz'" "select bars" Nothing) (threadDelay (3 * 10^(5::Int)) >> send (responseLBS status200 [] "bar")) (transactionId req)
+    ["bar"] -> datastoreSegment autoScope (DatastoreSegment "bar" SELECT "SELECT * FROM bar WHERE key =  'baz'" "select bars" Nothing) (threadDelay (3 * 10^(5::Int)) >> send (responseLBS status200 [] "bar")) (transactionId req)
     _       -> send (responseLBS status404 [] "not found")
diff --git a/helics-wai.cabal b/helics-wai.cabal
--- a/helics-wai.cabal
+++ b/helics-wai.cabal
@@ -1,5 +1,5 @@
 name:                helics-wai
-version:             0.2.0.2
+version:             0.4.0
 synopsis:            New Relic® agent SDK wrapper for wai.
 description:         
   New Relic® agent SDK wrapper for wai.
@@ -23,11 +23,12 @@
 library
   exposed-modules:     Network.Helics.Wai
                        Network.Helics.Wai.Safe
-  -- other-extensions:    
   build-depends:       base               >=4.6  && <4.8
                      , wai                >=3.0  && <3.1
                      , vault              >=0.3  && <0.4
-                     , helics             >=0.1  && <0.4
+                     , helics             >=0.4  && <0.5
+                     , data-default-class >=0.0  && <0.1
+                     , bytestring         >=0.10 && <0.11
   ghc-options:         -Wall -O2
   hs-source-dirs:      src
   default-language:    Haskell2010
@@ -35,7 +36,7 @@
 executable helics-wai-example
   main-is:             example.hs
   if flag(example)
-    build-depends:       base               >=4.6  && <4.8
+    build-depends:       base
                        , wai
                        , helics-wai
                        , warp
diff --git a/src/Network/Helics/Wai.hs b/src/Network/Helics/Wai.hs
--- a/src/Network/Helics/Wai.hs
+++ b/src/Network/Helics/Wai.hs
@@ -1,4 +1,14 @@
-module Network.Helics.Wai (helics, transactionId) where
+module Network.Helics.Wai
+    ( Safe.HelicsMiddlewareConfig(..)
+    -- * middleware
+    , helics
+    , dummyHelics
+    -- * getter
+    , transactionId
+    , lookupTransactionId
+    -- * reexports
+    , def
+    ) where
 
 import Network.Wai
 import Network.Helics
@@ -11,9 +21,15 @@
 {-# NOINLINE tidKey #-}
 
 -- | helics middleware.
-helics :: Middleware
+helics :: Safe.HelicsMiddlewareConfig -> Middleware
 helics = Safe.helics tidKey
 
+dummyHelics :: Middleware
+dummyHelics = Safe.dummyHelics tidKey
+
 -- | get TransactionId from request.
 transactionId :: Request -> TransactionId
 transactionId = Safe.transactionId tidKey
+
+lookupTransactionId :: Request -> Maybe TransactionId
+lookupTransactionId = Safe.lookupTransactionId tidKey
diff --git a/src/Network/Helics/Wai/Safe.hs b/src/Network/Helics/Wai/Safe.hs
--- a/src/Network/Helics/Wai/Safe.hs
+++ b/src/Network/Helics/Wai/Safe.hs
@@ -1,16 +1,49 @@
-module Network.Helics.Wai.Safe (helics, transactionId) where
+module Network.Helics.Wai.Safe
+    ( HelicsMiddlewareConfig(..)
+    -- * middleware
+    , helics
+    , dummyHelics
+    -- * getter
+    , transactionId
+    , lookupTransactionId
+    -- * reexports
+    , def
+    ) where
 
 import Network.Wai
 import Network.Helics
+import Network.Helics.Internal.Types (TransactionId(..))
+
+import Data.IORef
+import Data.Default.Class
 import Data.Vault.Lazy as V
+import qualified Data.ByteString as S
 
+newtype HelicsMiddlewareConfig = HelicsMiddlewareConfig
+    { transactionName :: Request -> S.ByteString
+    }
+
+instance Default HelicsMiddlewareConfig where
+    def = HelicsMiddlewareConfig rawPathInfo
+
 -- | helics middleware.
-helics :: Key TransactionId -> Middleware
-helics key app req send =
-   withTransaction (rawPathInfo req) def $ \tid -> do
+helics :: Key TransactionId -> HelicsMiddlewareConfig -> Middleware
+helics key conf app req send =
+    withTransaction (transactionName conf req) def $ \tid -> do
    setRequestUrl (rawPathInfo req) tid
    app req { vault = insert key tid (vault req) } send
 
+-- | Middleware which add dummy TransactionId to Request. since v0.4.0.
+dummyHelics :: Key TransactionId -> Middleware
+dummyHelics key app req send = do
+    err <- newIORef Nothing
+    app req { vault = insert key (TransactionId 0 err) (vault req) } send
+
 -- | get TransactionId from request.
 transactionId :: Key TransactionId -> Request -> TransactionId
-transactionId key req = maybe (error "helics middleware is not installed.") id $ V.lookup key (vault req)
+transactionId key req = maybe (error "helics middleware is not installed.") id $
+    lookupTransactionId key req
+
+-- | get TransactionId when middleware installed.
+lookupTransactionId :: Key TransactionId -> Request -> Maybe TransactionId
+lookupTransactionId key req = V.lookup key (vault req)
