diff --git a/README.md b/README.md index 8b81714..88fa8e7 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,71 @@ swift run -c release ResgenSwift strings tags $FORCE_FLAG "./Tags/tags.txt" \ > ⚠️ If extension name is not set or is `Tags`, it will generate the following typaloas `typealias Tags = String`. + +## Analytics + +Analytics will generate all you need to analyze UX with Matomo or Firebase Analytics. Input files are formatted in YAML. This command will generate a manager for each target and an AnalyticsManager. This is this one you will need to use. And it will generate a method for all tags you have declared in the YAML file. Next, you will need to use the `configure()` method of AnalyticsManager and if you want to use matomo to set up the `siteId` and the `url` of the site. + +```sh +swift run -c release ResgenSwift strings tags $FORCE_FLAG "./Tags/tags.txt" \ + --target "matomo firebase" \ + --extension-output-path "./Analytics/Generated" \ + --extension-name "AppAnalytics" \ + --extension-suffix "GreatApp" \ + --static-members true +``` + + **Parameters** + +1. `-f`: force generation +2. Input tags file (must be YAML formatted) +3. `--target`: target with you will log UX +4. `--extension-output-path`: path where to generate generated extension +5. `--extension-name` *(optional)* : name of class to add the extension +6. `--extension-suffix` *(optional)* : additional text which is added to filename (ex: `AppAnalytics+GreatApp.swift`) +7. `--static-members` *(optional)*: generate static properties or not + +> ⚠️ If extension name is not set or is `Analytics`, it will generate the following typaloas `typealias Analytics = String`. + +### YAML + +``` + - id: s1_def_one + name: s1 def one _TITLE_ + path: s1_def_one/_TITLE_ + action: Tap + category: User + tags: ios,droid + comments: + parameters: + - name: title + type: String + replaceIn: name,path +``` + +1. `id`: name of the method (method name will be composed of `log` + `Event|Screen` + `id`) +2. `name`: name of the tag +3. `path` *(optional with firebase)* : needed for matomo but not with firebase (log screen) +4. `action` *(optional with firebase)* : needed for matomo but not with firebase (log event) +5. `category` *(optional with firebase)* : needed for matomo but not with firebase (log event) +6. `tags`: which platform target +7. `comments` *(optional)* +8. `parameters` *(optional)* + + **Parameters** + +You can use parameters in generate methods. + +1. `name`: name of the parameter +2. `type`: type of the parameter (Int, String, Bool, Double) +3. `replaceIn` *(optional)* + +**Replace in** + +This is section is equivalent of `%s | %d | %f | %@`. You can put the content of the parameter in *name*, *path*, *action*, *category*. +You need to put `_` + `NAME OF THE PARAMETER` + `_` in the target and which target you want in the value of `replaceIn`. (name need to be in uppercase) + + ## Images Images generator will generate images assets along with extensions to access those images easily.