Skip to content

Commit

Permalink
Components for Realtime User Monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrtak-CZ committed Oct 3, 2013
1 parent 2f05e93 commit 644d5ff
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,39 @@ newrelic:
paramName: paramValue
```

Realtime User Monitoring
------------------------

add this component factory to your base presenter

```php
protected function createComponentNewRelicHeader()
{
$control = new \VrtakCZ\NewRelic\RUM\HeaderControl;
$control->disableScriptTag(); // optionall
return $control;
}

protected function createComponentNewRelicFooter()
{
$control = new \VrtakCZ\NewRelic\RUM\FooterControl;
$control->disableScriptTag(); // optionall
return $control;
}
```

and add this to your `@layout` header (before `</head>`)

```smarty
{control newRelicHeader}
```

and add this to your `@layout` footer (before `</body>`)

```smarty
{control newRelicFooter}
```

License
-------
NewRelic Nette is licensed under the MIT License - see the LICENSE file for details
Expand Down
23 changes: 23 additions & 0 deletions src/VrtakCZ/NewRelic/RUM/FooterControl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace VrtakCZ\NewRelic\RUM;

class FooterControl extends \Nette\Application\UI\Control
{
/** @var bool */
private $withScriptTag = TRUE;

/**
* @return HeaderControl
*/
public function disableScriptTag()
{
$this->withScriptTag = FALSE;
return $this;
}

public function render()
{
echo newrelic_get_browser_timing_footer($this->withScriptTag);
}
}
23 changes: 23 additions & 0 deletions src/VrtakCZ/NewRelic/RUM/HeaderControl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace VrtakCZ\NewRelic\RUM;

class HeaderControl extends \Nette\Application\UI\Control
{
/** @var bool */
private $withScriptTag = TRUE;

/**
* @return HeaderControl
*/
public function disableScriptTag()
{
$this->withScriptTag = FALSE;
return $this;
}

public function render()
{
echo newrelic_get_browser_timing_header($this->withScriptTag);
}
}

0 comments on commit 644d5ff

Please sign in to comment.