Skip to content

Commit

Permalink
Merge pull request #12 from Vendic/feature/add-rum-prefix
Browse files Browse the repository at this point in the history
Add RUM prefix to tracking id
  • Loading branch information
peterjaap authored Jan 31, 2025
2 parents 80b7523 + 8d7f41c commit 7011a76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ViewModel/Rumvision.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function shouldIncludeScript(): bool

public function getTrackingId() :string
{
return $this->configuration
->getTrackingId();
$trackingId = $this->configuration->getTrackingId();
return str_starts_with($trackingId, 'RUM-') ? $trackingId : sprintf('RUM-%s', $trackingId);
}

public function getHostName() :string
Expand Down
4 changes: 2 additions & 2 deletions src/view/frontend/templates/script/rumvision.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ if (! $viewModel->shouldIncludeScript()) {
if ( s.urls && s.regex && ( s.page = eval('('+s.regex+')')( s.urls, vi.location.pathname ) ) && !s.page.type ) {
return sessionStorage.setItem('rumv', JSON.stringify( s ) );
}

vi.rumv.storage = s;
var head = si.querySelector('head'), js = si.createElement('script');
js.src = 'https://d5yoctgpv4cpx.cloudfront.net/'+rum+'/v4-'+vi.location.hostname+'.js';
head.appendChild(js);
})( 'RUM-<?= $escaper->escapeJs($viewModel->getTrackingId()) ?>', window, document, '<?= $escaper->escapeJs($viewModel->getHostName()) ?>' );
})( '<?= $escaper->escapeJs($viewModel->getTrackingId()) ?>', window, document, '<?= $escaper->escapeJs($viewModel->getHostName()) ?>' );
</script>

0 comments on commit 7011a76

Please sign in to comment.