Skip to content

Commit

Permalink
docs: update documentation & instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
mayrop committed Aug 23, 2024
1 parent 88868bf commit 96973f0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 12 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,36 @@
## Summary

This repository contains a [Google Tag Manager Variable template](https://developers.google.com/tag-manager/templates) that makes it possible to clean up URLs to remove any personally identifiable information (PII) before sending them to analytics or third-party platforms.

## Options

### URL
A URL to clean such as **{{Page URL}}** or **{{Referrer}}** (built-in variables), but you can redact other URLs as well.

### Replacement
Text that will overwrite the original content, by default `[redacted]`.

### Query Parameter Keys
List the query parameter keys to replace, separated by '|'. Each key will be treated as a regular expression. For example, entering `phone_` will redact any query parameter keys starting with `phone_`, such as `phone_main` and `phone_office`. To use exact matches instead of regular expressions, the `paramKeysFullMatch` checkbox should be enabled.

### Query Parameter Values
Query parameter values with dynamic or unknown keys can be redacted if the value matches a specified regular expression.

### Keys Full Match
By default, the keys are treated as regular expressions. For example, `phone_` will match all parameter keys starting with `phone_`, such as `phone_main` and `phone_office`. Check this box to disable regular expression matching and use exact key matching instead.

## Examples
<img src="images/example01.png" width=400>

### Example 1
**URL:**
`https://example.com/?first_name=my first name&last_name=my last name&cellphone=123-456-7890&mainphone=000-000-000&10_Hash=My_Hash&foo=bar`
**Replacement:** `[redacted]`
**Query Parameter Keys:** `name|phone|\d+`

Redacted URL:
`https://example.com/?first_name=[redacted]&last_name=[redacted]&cellphone=[redacted]&mainphone=[redacted]&10_Hash=[redacted]&foo=bar`


## Contributing
See our [contributing guidelines](CONTRIBUTING.md).
Binary file added images/example01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 12 additions & 12 deletions template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ ___INFO___
"version": 1,
"securityGroups": [],
"displayName": "PII - URL Cleaner",
"description": "Cleans PII from a URL by redacting query parameters by key or value. Supports regular expressions. Ensure you clean up URLs to remove any PII before sending to analytics or third-party platform.",
"description": "Removes PII from URLs by redacting query parameters based on key or value, with support for regular expressions. Make sure to clean URLs to remove any PII before sending them to analytics or third-par",
"containerContexts": [
"WEB"
],
"categories": [
"UTILITY"
]
]
}


Expand All @@ -47,7 +47,14 @@ ___TEMPLATE_PARAMETERS___
"displayName": "Query Parameter Keys",
"simpleValueType": true,
"defaultValue": "name|email|token",
"help": "List of query parameter keys to replace separated by \"|\". Note that each value will be treated as a regular expression. So if you input utm_ it will redact any query parameter keys that start with utm_."
"help": "List the query parameter keys to replace, separated by \u0027|\u0027. Each key will be treated as a regular expression. For example, entering \u003ccode\u003eutm_\u003c/code\u003e will redact any query parameter keys starting with \u003ccode\u003eutm_\u003c/code\u003e. To use exact matches instead of regular expressions, check the \u003ccode\u003eparamKeysFullMatch\u003c/code\u003e checkbox below."
},
{
"type": "CHECKBOX",
"name": "paramKeysFullMatch",
"checkboxText": "Keys Full Match",
"simpleValueType": true,
"help": "By default, the keys are treated as regular expressions. For example, \u003ccode\u003eutm_\u003c/code\u003e will match all parameter keys starting with \u003ccode\u003eutm_\u003c/code\u003e, such as \u003ccode\u003eutm_source\u003c/code\u003e and \u003ccode\u003eutm_medium\u003c/code\u003e. Check this box to disable regular expression matching and use exact key matching instead."
},
{
"type": "PARAM_TABLE",
Expand Down Expand Up @@ -77,14 +84,7 @@ ___TEMPLATE_PARAMETERS___
],
"newRowButtonText": "New Pattern",
"alwaysInSummary": false,
"help": "For query parameter values where the key is dynamic or the key is unknown, it can be redacted if the value matches a regular expression."
},
{
"type": "CHECKBOX",
"name": "paramKeysFullMatch",
"checkboxText": "Keys Full Match",
"simpleValueType": true,
"help": "By default, the keys will be treated as regular expressions. Like \u003ccode\u003eutm_\u003c/code\u003e will match all the parameter keys that start with \u003ccode\u003eutm_\u003c/code\u003e such as \u003ccode\u003eutm_source\u003c/code\u003e and \u003ccode\u003eutm_medium\u003c/code\u003e. Enable this checkbox to disable this behavior."
"help": "Query parameter values with dynamic or unknown keys can be redacted if the value matches a specified regular expression."
}
]

Expand Down Expand Up @@ -334,6 +334,6 @@ scenarios:

___NOTES___

Created on 8/22/2024, 1:52:51 PM
Created on 8/23/2024, 2:05:59 AM


0 comments on commit 96973f0

Please sign in to comment.