Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audience UI #36

Merged
merged 102 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
a4b8403
wip, adding base audience UI files
roborourke Feb 28, 2020
09af3c0
basic rule picker
roborourke Feb 28, 2020
c528a36
remembered the milliseconds helper function
roborourke Feb 28, 2020
6f45689
added functional basic group and rule editing UI
roborourke Mar 4, 2020
746b3dd
added styling and file organisation to rule editor UI
roborourke Mar 4, 2020
fb94877
updated deploy excludes to leave src directory
roborourke Mar 4, 2020
af75df9
adding scaffolding for audience API endpoints
roborourke Mar 4, 2020
967d958
adding data fetching from api using hooks
roborourke Mar 5, 2020
598317d
adding rest routes for audience fields and estimates
roborourke Mar 5, 2020
a96461d
estimate endpoint and query hooked up and working
roborourke Mar 6, 2020
2b8d69b
enable saving and loading audience config
roborourke Mar 9, 2020
262452e
added admin column for estimate
roborourke Mar 10, 2020
9971f92
move estimate styling into the component
roborourke Mar 10, 2020
acf765e
remove bulk and quick edit for audiences
roborourke Mar 10, 2020
333d167
remove estimate header margin
roborourke Mar 10, 2020
43d2197
estimate styling tweaks
roborourke Mar 10, 2020
ca3c235
estimate styling tweaks
roborourke Mar 10, 2020
3ce3c66
rename field registration functions
roborourke Mar 10, 2020
e1dc852
add docs for register_field() function
roborourke Mar 10, 2020
f078c8f
Fix the cache expiry times
roborourke Mar 11, 2020
df3548a
check histogram property is set
roborourke Mar 12, 2020
214edd7
merge master
roborourke Mar 14, 2020
c0fba00
Merge branch 'audience-ui' of github.com:humanmade/analytics into aud…
roborourke Mar 16, 2020
5fe6316
merge master
roborourke Mar 16, 2020
c279a6b
Apply suggestions from code review
roborourke Mar 16, 2020
b40f72d
Merge branch 'audience-ui' of github.com:humanmade/analytics into aud…
roborourke Mar 16, 2020
9f45682
Apply code review suggestions for PHP
roborourke Mar 16, 2020
aa0a3a3
fix js code style
roborourke Mar 16, 2020
e8a5d15
remove id from select-include component
roborourke Mar 16, 2020
c7b8eff
fix beforeunload leave site prompt
roborourke Mar 17, 2020
26d3d23
Refactor to class components
roborourke Mar 17, 2020
9461dc9
code style fixes
roborourke Mar 17, 2020
15c97bf
moved the group and rule remove buttons into the components
roborourke Mar 17, 2020
b24c776
refactoring to use wp.data.registerStore()
roborourke Mar 18, 2020
f4612cb
completed updates to use redux store
roborourke Mar 19, 2020
69de06b
fix code style issues
roborourke Mar 19, 2020
a74f65e
improve table listing estimate styling
roborourke Mar 19, 2020
be60628
switch to asset hash names instead of string replace on deploy
roborourke Mar 19, 2020
479b9f8
styling tweaks for estimate percentage
roborourke Mar 19, 2020
fb9892b
fix setStatus usage
roborourke Mar 19, 2020
213a90b
usability improvement: add title for audience estimate and options
roborourke Mar 19, 2020
df0353c
remove unused use statements
roborourke Mar 20, 2020
cfd06b5
code style fix, bracket spacing
roborourke Mar 20, 2020
755721d
fix a bug if a draft is autosaved but the audience config is null
roborourke Mar 31, 2020
6d2bbda
Use the namespace instead of individual functions
rmccue Apr 2, 2020
a9eb632
Use WordPress constants for time blocks
rmccue Apr 2, 2020
ea36ad7
Correct misspelling of function name
rmccue Apr 2, 2020
2849678
Use namespace instead of functions in REST API
rmccue Apr 2, 2020
94f2bac
Rename permissions callback to make obvious
rmccue Apr 2, 2020
89de63b
Reformat trigger_error calls
rmccue Apr 2, 2020
4cf92c9
Break up composite boolean check
rmccue Apr 2, 2020
045c281
echo sprintf( -> printf(
rmccue Apr 2, 2020
1cb5dd0
Use PHP-style variable default
rmccue Apr 2, 2020
3acb1d1
Format arrays for one entry per line
rmccue Apr 2, 2020
77bba09
Merge pull request #43 from humanmade/audience-ui-iterations
rmccue Apr 2, 2020
31515f1
Add class properties transform
rmccue Apr 3, 2020
c8c9ed5
Avoid mutating variables in favour of spreads
rmccue Apr 3, 2020
04aa288
Convert Group to class to match AudienceEditor
rmccue Apr 3, 2020
4baa64a
Prop-sort props
rmccue Apr 3, 2020
8f85133
Add newlines before titles
rmccue Apr 3, 2020
abedf83
Group relative imports
rmccue Apr 3, 2020
12351b0
Split rule input to component
rmccue Apr 3, 2020
8453626
Use .find instead of .filter()[0]
rmccue Apr 3, 2020
587f162
Use extant data instead of reparsing
rmccue Apr 3, 2020
091bcb8
Remove unused fragment
rmccue Apr 3, 2020
da03abb
Space out options more
rmccue Apr 3, 2020
809e5e5
Apply withSelect/withDispatch via compose
rmccue Apr 3, 2020
e15a3aa
Use on* names for callbacks
rmccue Apr 3, 2020
4ee0085
Unpack props before state
rmccue Apr 3, 2020
20fb23a
Sort and format more props
rmccue Apr 3, 2020
2158482
Bind in the initialiser
rmccue Apr 3, 2020
54b3fee
Move state/titleRef initialisers to class
rmccue Apr 3, 2020
42c5130
Replace manual title focus with autoFocus
rmccue Apr 3, 2020
05b4bb5
Remove redundant arrow function
rmccue Apr 3, 2020
d06a713
Remove unused import
rmccue Apr 3, 2020
5351cd3
Move export default into declaration
rmccue Apr 3, 2020
5365adb
Split registerStore call up for readability
rmccue Apr 3, 2020
f31bcca
Rename and reformat initialState
rmccue Apr 3, 2020
7a4a1e2
Avoid unnecessary slice
rmccue Apr 3, 2020
38e1afa
Use a standard else
rmccue Apr 3, 2020
56f632a
Refactor some of the reducer
rmccue Apr 3, 2020
1484bfb
Get spacey with it
rmccue Apr 3, 2020
0ef26ea
Conjoin generator symbol with function name
rmccue Apr 3, 2020
9754b18
Merge pull request #44 from humanmade/audience-ui-reacty-stuff
rmccue May 1, 2020
8699e78
Use helpers instead of using globals directly
rmccue May 4, 2020
90a6c96
Unnest inline functions
rmccue May 4, 2020
1ce7a17
Always slash meta values
rmccue May 4, 2020
e61a822
Indent comments with 4 spaces, not 2
rmccue May 4, 2020
f1cdce5
Move comparison operators to constant
rmccue May 4, 2020
74ed607
Reformat schema
rmccue May 4, 2020
70e3422
Use "set up" for the verb form
rmccue May 4, 2020
a53e14a
Switch from array_map to foreach
rmccue May 4, 2020
609d183
Add title/excerpt support to audiences
rmccue May 4, 2020
ec26fea
Break out schemas for readability
rmccue May 4, 2020
5c9f471
Translate JSON error messages
rmccue May 4, 2020
00b54eb
Add additional phpdoc
rmccue May 4, 2020
2a2bdb1
Only log queries on ALTIS_ANALYTICS_LOG_QUERIES
rmccue May 4, 2020
668b1e0
Avoid double array indexing
rmccue May 4, 2020
8d715cc
Add nonce check for audience updating
rmccue May 4, 2020
c7f6e5f
Correct permission check for audience endpoints
rmccue May 4, 2020
a9a2376
Add translator comments
rmccue May 4, 2020
11057a2
Merge pull request #45 from humanmade/audience-ui-final-bits
roborourke May 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .circleci/deploy-exclude.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
node_modules
package.json
package-lock.json
src
webpack.config.js
5 changes: 0 additions & 5 deletions .circleci/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ fi

rsync -av "$SRC_DIR/" "$BUILD_DIR" --exclude-from "$SRC_DIR/.circleci/deploy-exclude.txt"

# Swap commit placeholders
SCRIPT_HASH=$(md5sum build/analytics.js | awk '{ print $1 }')
find . -name '*.php' | xargs sed -i.bak 's/__SCRIPT_HASH__/'"$SCRIPT_HASH"'/g'
find . -name '*.bak' -delete

# Add changed files
git add .

Expand Down
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "humanmade",
"globals": {
"Altis": "readonly"
"Altis": "readonly",
"wp": "readonly"
},
"rules": {
"no-multi-str": "off",
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ Similar to `registerAttribute()` above but for metrics.

Allows you to define the Elasticsearch server URL directly.

**`ALTIS_ANALYTICS_LOG_QUERIES`**

Define as true to enable logging queries to the error log.

### Filters

The plugin provides a few hooks for you to control the default endpoint data and attributes recorded with events.
Expand Down Expand Up @@ -131,6 +135,9 @@ A user session covers every event recorded between opening the website and closi
- `ModelVersion`: Browser version.
- `Platform`: The device operating system.
- `PlatformVersion`: The operating system version.
- `Location`
- `Country`: The endpoint's country if known / available.
- `City`: The endpoint's city if known or available.
- `User`
- `UserAttributes`
- Any custom attributes associated with the user if known.
Expand Down Expand Up @@ -224,6 +231,28 @@ The output will look something like the following:

You can further trim the size of the returned response using the `filter_path` query parameter. For example if we're only interested in the stats aggregation we can set `filter_path=-aggregations.sessions` to remove it from the response.

## Audiences

Audiences are user-defined categories of users, based on conditions related to their analytics data.

Audiences allow for the creation of conditions to narrow down event queries or endpoints but also can be used for determining effects on the client side.
roborourke marked this conversation as resolved.
Show resolved Hide resolved

### Mapping Event Data

To enable the use of any event record data in the audience editor it needs to be mapped to a human readable label using the `Altis\Analytics\Audiences\register_field()` function:

```php
use function Altis\Analytics\Audiences\register_field;

add_action( 'init', function () {
register_field( 'endpoint.Location.City', __( 'City' ) );
} );
```

In the above example the 1st parameter `endpoint.Location.City` represents the field in the event record to query against. Other examples include `attributes.utm_campaign` or `endpoint.User.UserAttibrutes.custom` for example.

The 2nd parameter is a human readable label for the audience field.

## Required Infrastructure

A specific infrastructure set up is required to use this plugin:
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"description": "AWS Pinpoint Analytics integration for WordPress",
"type": "wordpress-plugin",
"require": {
"aws/aws-sdk-php": "^3.103.0"
"aws/aws-sdk-php": "^3.103.0",
"johnbillion/extended-cpts": "^4.3.2"
roborourke marked this conversation as resolved.
Show resolved Hide resolved
},
"license": "GPL-2.0-or-later",
"authors": [
Expand Down
Loading