Skip to content

Commit c88dca7

Browse files
author
Stanislav Idolov
committed
MAGETWO-68845: Universal Analytics doesn't work when Cookie Restriction is enabled
1 parent 2c4db93 commit c88dca7

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

app/code/Magento/GoogleAnalytics/Block/Ga.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function isCookieRestrictionModeEnabled()
184184
*
185185
* @return int
186186
*/
187-
public function getCurrentWebsite()
187+
public function getCurrentWebsiteId()
188188
{
189189
return $this->_storeManager->getWebsite()->getId();
190190
}

app/code/Magento/GoogleAnalytics/Test/Unit/Block/GaTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ public function testIsCookieRestrictionModeEnabled()
128128
$this->assertFalse($this->gaBlock->isCookieRestrictionModeEnabled());
129129
}
130130

131-
public function testGetCurrentWebsite()
131+
public function testGetCurrentWebsiteId()
132132
{
133133
$websiteId = 100;
134134
$websiteMock = $this->getMockBuilder(\Magento\Store\Api\Data\WebsiteInterface::class)->getMock();
135135
$websiteMock->expects($this->once())->method('getId')->willReturn($websiteId);
136136
$this->storeManagerMock->expects($this->once())->method('getWebsite')->willReturn($websiteMock);
137-
$this->assertEquals($websiteId, $this->gaBlock->getCurrentWebsite());
137+
$this->assertEquals($websiteId, $this->gaBlock->getCurrentWebsiteId());
138138
}
139139

140140
public function testOrderTrackingData()

app/code/Magento/GoogleAnalytics/view/frontend/templates/ga.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
{
1515
"*": {
1616
"Magento_GoogleAnalytics/js/google-analytics": {
17-
"isCookieRestrictionModeEnabled": <?php /* @escapeNotVerified */ echo (int)$block->isCookieRestrictionModeEnabled(); ?>,
18-
"currentWebsite": <?php /* @escapeNotVerified */ echo (int)$block->getCurrentWebsite(); ?>,
17+
"isCookieRestrictionModeEnabled": <?php echo (int)$block->isCookieRestrictionModeEnabled(); ?>,
18+
"currentWebsite": <?php echo (int)$block->getCurrentWebsiteId(); ?>,
1919
"cookieName": "<?php /* @escapeNotVerified */ echo \Magento\Cookie\Helper\Cookie::IS_USER_ALLOWED_SAVE_COOKIE; ?>",
2020
"ordersTrackingData": <?php /* @escapeNotVerified */ echo json_encode($block->getOrdersTrackingData()); ?>,
2121
"pageTrackingData": <?php /* @escapeNotVerified */ echo json_encode($block->getPageTrackingData($accountId)); ?>

0 commit comments

Comments
 (0)