Skip to content

Commit

Permalink
Merge pull request #537 from matomo-org/L3-761-disable-reimport-ga3
Browse files Browse the repository at this point in the history
Disabled re-import date range feature for GA3, #L3-761
  • Loading branch information
AltamashShaikh authored Jul 12, 2024
2 parents e122b4e + 151476e commit eb76f72
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 46 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog

# 4.6.12
- Important: Disabled re-import date range feature for GA3 imports to avoid deleting of existing data

# 4.6.11
- Ignore custom dimensions assigned the Item scope

Expand Down
4 changes: 3 additions & 1 deletion Commands/ImportReports.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ protected function executeImpl(InputInterface $input, OutputInterface $output)
return;
}

$dateRangesToReImport = empty($status['reimport_ranges']) ? [] : $status['reimport_ranges'];
// Disabled reimport of daterange for GA3
// $dateRangesToReImport = empty($status['reimport_ranges']) ? [] : $status['reimport_ranges'];
$dateRangesToReImport = [];
$dateRangesToReImport = array_map(function ($d) {
return [Date::factory($d[0]), Date::factory($d[1])];
}, $dateRangesToReImport);
Expand Down
3 changes: 3 additions & 0 deletions Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ public function scheduleReImport()
new Site($idSite);

$isGA4 = Common::getRequestVar('isGA4', 0, 'int') == 1;
if (!$isGA4) {
throw new \Exception('Reimport for GA3 is disabled, as it will lead to data loss for already imported date ranges.');
}
$startDate = Common::getRequestVar('startDate', null, 'string');
$startDate = Date::factory($startDate);

Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "GoogleAnalyticsImporter",
"description": "Import reports from a Google Analytics account into Matomo.",
"version": "4.6.11",
"version": "4.6.12",
"theme": false,
"require": {
"matomo": ">=4.10.0-b1,<5.0.0-b1"
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/ImportedFromGoogle.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public function setUp(): void
$this->getGoogleAnalyticsParams();

$this->runGoogleImporter($this->importedDateRange1);
$this->extendEndDate($idSite = 1, '2019-06-27', '2019-07-02');
$this->scheduleReimport($idSite = 1, '2019-06-27', '2019-06-27');
$this->extendEndDate($idSite = 1, '2019-06-27', '2019-06-27');
// $this->scheduleReimport($idSite = 1, '2019-06-27', '2019-06-27');

$output = $this->runGoogleImporter($this->importedDateRange2, $idSite = 1);
$this->assertStringContainsString('Importing the following date ranges in order: 2019-06-27,2019-06-27', $output);
Expand Down
19 changes: 0 additions & 19 deletions tests/UI/GoogleAnalyticsImporter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,6 @@ describe("GoogleAnalyticsImporter", function () {
expect(await content.screenshot()).to.matchImage('resumed_import');
});

it('should schedule a re-import when the modal is used', async function () {
await page.waitForTimeout(90000);

await page.click('#reimport-date-range');

await page.waitForSelector('#openScheduleReimportModal', { visible: true });
await page.type('#re-import-start-date', '2019-06-27');
await page.type('#re-import-end-date', '2019-06-27');

await page.click('#scheduleReimportSubmit');
await page.waitForNetworkIdle();
await page.waitForSelector('.pageWrap');

await removeStartResumeFinishTime();

const content = await page.$('.pageWrap');
expect(await content.screenshot()).to.matchImage('reimport_range');
});

it("should show that the import finished when the import finishes", async function () {
let totalTime = 0;
while (true) { // wait until import finishes
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 23 additions & 22 deletions vue/dist/GoogleAnalyticsImporter.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vue/dist/GoogleAnalyticsImporter.umd.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions vue/src/ImportStatus/ImportStatusRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<a
id="reimport-date-range"
class="table-command-link"
v-if="status.isGA4"
href
@click.prevent="$emit('reimport')"
>
Expand Down

0 comments on commit eb76f72

Please sign in to comment.