-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4912 from yKazihara/feature/google_analytics
Googleアナリティクス機能を追加
- Loading branch information
Showing
12 changed files
with
526 additions
and
393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20210216120000 extends AbstractMigration | ||
{ | ||
public function up(Schema $schema): void | ||
{ | ||
// データ存在チェック | ||
$count = $this->connection->fetchColumn("SELECT COUNT(*) FROM dtb_block WHERE block_name = 'Googleアナリティクス'"); | ||
if ($count > 0) { | ||
return; | ||
} | ||
|
||
// idを取得する | ||
$id = $this->connection->fetchColumn('SELECT MAX(id) FROM dtb_block'); | ||
$id++; | ||
|
||
$this->addSql("INSERT INTO dtb_block (id, block_name, file_name, use_controller, deletable, create_date, update_date, device_type_id, discriminator_type) VALUES ($id, 'Googleアナリティクス', 'google_analytics', false, false, '2021-02-16 12:00:00', '2021-02-16 12:00:00', 10, 'block')"); | ||
$this->addSql("INSERT INTO dtb_block_position (section, block_id, layout_id, block_row, discriminator_type) VALUES (1, $id, 1, 0, 'blockposition')"); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/Eccube/Resource/template/default/Block/google_analytics.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{# | ||
This file is part of EC-CUBE | ||
Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. | ||
http://www.ec-cube.co.jp/ | ||
For the full copyright and license information, please view the LICENSE | ||
file that was distributed with this source code. | ||
#} | ||
{% if BaseInfo.ga_id is not empty %} | ||
<!-- Global site tag (gtag.js) - Google Analytics --> | ||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ BaseInfo.ga_id }}"></script> | ||
<script> | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | ||
gtag('config', '{{ BaseInfo.ga_id }}'); | ||
</script> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters