Skip to content

Commit e9740c0

Browse files
author
Andrew Mc Cormack
committed
update readme with YML container config info
1 parent 3cc1ba5 commit e9740c0

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ A Silverstripe module to add Google Tag Manager Version 2 datalayer, event, and
2828

2929
- [Installation](/docs/installation)
3030
- [Composer](/docs/installation#composer)
31-
- [Controller and View](/docs/installation#controller-and-view)
31+
- [Package Namespace](/docs/installation#package-namespace)
3232
- [Validating your Search Console property](/docs/installation#validating-your-search-console-property)
3333
- [Pushing Data](/docs/data)
3434
- [Pushing to the data layer](/docs/data#pushing-to-the-data-layer)

docs/installation/README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,31 @@ Add the following to your composer.json file
77
```json
88
{
99
"require": {
10-
"cyber-duck/silverstripe-google-tag-manager": "1.0.*"
10+
"cyber-duck/silverstripe-google-tag-manager": "4.0.*"
1111
}
1212
}
1313
```
1414

1515
Run composer and then flush the Silverstripe cache (add ?flush=all to your URL and reload the page)
1616

17-
## Controller
17+
## Package Namespace
1818

19-
Add the following method to the Page_Controller in your Page.php file located in your code folder. Replace XXXXX with the ID of your container which you can get from the Tag Manager interface. It takes the format GTM-XXXXX, however you don't need to include the GTM part.
19+
All classes can be referenced via:
2020

21-
```php
22-
class Page_Controller extends ContentController {
21+
CyberDuck\GTM
2322

24-
public function TagManager()
25-
{
26-
return GTM::snippet('XXXXX');
27-
}
28-
}
23+
e.g CyberDuck\GTM\GTM::snippet();
24+
25+
## Configuring your container ID
26+
27+
Add the following method to the Page_Controller in your Page.php file located in your code folder. Replace XXXXX with the ID of your container which you can get from the Tag Manager interface. It takes the format GTM-XXXXX, however you don't need to include the GTM part.
28+
29+
```yml
30+
CyberDuck\GTM\GTM
31+
container_id: 123456
2932
```
3033
31-
Within your Page.ss template or similar add the $TagManager variable after your opening body tag to call your controller method.
34+
Within your Page.ss template or similar add the $TagManager variable after your opening body tag to call the GTM snippet code.
3235
3336
```php
3437
<body>

0 commit comments

Comments
 (0)