-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
297 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(ns status-im.acquisition.install-referrer | ||
(:require [taoensso.timbre :as log] | ||
[clojure.string :as cstr] | ||
["react-native-device-info" :refer [getInstallReferrer]])) | ||
|
||
(defn- split-param [param] | ||
(-> | ||
(cstr/split param #"=") | ||
(concat (repeat "")) | ||
(->> | ||
(take 2)))) | ||
|
||
(defn- url-decode | ||
[string] | ||
(some-> string str (cstr/replace #"\+" "%20") (js/decodeURIComponent))) | ||
|
||
(defn- query->map | ||
[qstr] | ||
(when-not (cstr/blank? qstr) | ||
(some->> (cstr/split qstr #"&") | ||
seq | ||
(mapcat split-param) | ||
(map url-decode) | ||
(apply hash-map)))) | ||
|
||
(defn parse-referrer | ||
"Google return query params for referral with all utm tags" | ||
[referrer] | ||
(-> referrer query->map (get "referrer"))) | ||
|
||
(defn get-referrer [cb] | ||
(-> (getInstallReferrer) | ||
(.then cb) | ||
(.catch #(log/error "[install-referrer]" %)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.