Skip to content

Commit 83d1fe7

Browse files
authored
Merge pull request #15 from webbuilders-group/feature-silverstripe-6
FEATURE: Support Silverstripe 6
2 parents 31c09a6 + 408a1d2 commit 83d1fe7

5 files changed

Lines changed: 16 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Notable changes to this project will be documented in this file.
44

5+
## [5.0.0]
6+
7+
- Support for Silverstripe 6
8+
59
## [4.0.4]
610

711
- Add void return type for PHP 8 compatibility with Functional Test

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ It automatically includes optional unobtrusive **event tracking** for all outbou
1313
- Automatic `pageview` tracking for all configured accounts, including tracking of 404 & 500 page errors (tracked as "Page Not Found" / "Page Error" events).
1414
- Unobtrusive outbound, download, email & tel: link tracking - monitors all page clicks, rather than on page load (ie: works with links including those generated by Ajax etc on the page after page load).
1515
- Uses Google Analytics `hitCallback` for tracking for outgoing links to register before load (ie: when no link `target` is set) to ensure tracker is successfully run before redirection.
16-
- Tracking codes are automatically changed to `UA-DEV-[1-9]` if `SS_ENVIRONMENT_TYPE` is **not** live, or if page URL matches ?flush= to prevent bad data capture.
16+
- Tracking codes are automatically changed to `G-XXXXXXXX-[1-9]` if `SS_ENVIRONMENT_TYPE` is **not** live, or if page URL matches ?flush= to prevent bad data capture.
1717

1818
### Event tracking
1919

@@ -30,7 +30,9 @@ Event category names (eg: "Outgoing Links", "Downloads" etc) can be configured i
3030

3131
## Requirements
3232

33-
- Silverstripe ^4 || ^5
33+
- Silverstripe ^6
34+
35+
For Silverstripe 4 & 5, please refer to the [Silverstripe5 branch](https://github.com/axllent/silverstripe-analytics-js/tree/silverstripe5).
3436

3537
For the deprecated `analytics.js` tracking method for Silverstripe 4, please refer to the [analytics.js branch](https://github.com/axllent/silverstripe-analytics-js/tree/3-analyticsjs).
3638

@@ -50,22 +52,22 @@ Once installed the extension is automatically loaded if you provide at least one
5052
```yaml
5153
Axllent\AnalyticsJS\AnalyticsJS:
5254
tracker:
53-
- ['config', 'UA-1234567-1']
55+
- ['config', 'G-XXXXXXXX']
5456
```
5557
5658
The syntax is very similar to the official documentation, so things like secondary trackers or other configurations can be easily added.
5759
5860
```yaml
5961
Axllent\AnalyticsJS\AnalyticsJS:
6062
tracker:
61-
- ['config', 'UA-1234567-1'] # default account [required]
62-
- ['config', 'UA-1234567-2'] # add secondary tracker
63+
- ['config', 'G-XXXXXXXX'] # default account [required]
64+
- ['config', 'G-XXXXXXXX-1'] # add secondary tracker
6365
- ['set', 'forceSSL', true] # force tracking to use SSL
6466
- ['require', 'ecommerce', 'ecommerce.js'] # load ecommerce extension
6567
track_links: false # disable external link & asset tracking
6668
ignore_link_class: "notrack" # if "track_links", then ignore external links with the "notrack" class
6769
compress_js: false # do not compress inline JavaScript
68-
primary_gtag_id: "UA-1234567-1" # set the default tracking id to be used when loading gtag (defaults to the first tracker)
70+
primary_gtag_id: "G-XXXXXXXX" # set the default tracking id to be used when loading gtag (defaults to the first tracker)
6971
```
7072
7173
Please refer to the [Configuration.md](docs/en/Configuration.md) for all configuration options.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"issues": "https://github.com/axllent/silverstripe-analytics-js/issues"
2121
},
2222
"require": {
23-
"silverstripe/framework": "^4.0 || ^5.0"
23+
"silverstripe/framework": "^6.0"
2424
},
2525
"autoload": {
2626
"psr-4": {

docs/en/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
```yaml
66
Axllent\AnalyticsJS\AnalyticsJS:
77
tracker:
8-
- ['config', 'UA-1234567-1']
8+
- ['config', 'G-XXXXXXXX']
99
```
1010
1111
@@ -25,5 +25,5 @@ Axllent\AnalyticsJS\AnalyticsJS:
2525
page_404_category: "Page Not Found" # 404 page category name for GA event logging
2626
page_error_category: "Page Error" # Error page category (not 404) for GA event logging
2727
track_in_dev_mode: true # Allow live tracking in dev/staging mode
28-
primary_gtag_id: "UA-1234567-1" # Set the default tracking id to be used when loading gtag (defaults to the first tracker)
28+
primary_gtag_id: "G-XXXXXXXX" # Set the default tracking id to be used when loading gtag (defaults to the first tracker)
2929
```

src/AnalyticsJS.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use SilverStripe\Control\Director;
77
use SilverStripe\Core\Config\Config;
88
use SilverStripe\Core\Extension;
9-
use SilverStripe\View\ArrayData;
9+
use SilverStripe\Model\ArrayData;
1010
use SilverStripe\View\Requirements;
1111

1212
/**

0 commit comments

Comments
 (0)