Skip to content

Commit

Permalink
feat(tracking): Declare CSP directives
Browse files Browse the repository at this point in the history
  • Loading branch information
torotil committed Nov 8, 2024
1 parent 217d057 commit 5b82d6e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ function campaignion_tracking_ga4_campaignion_tracking_snippets() {
return $exports;
}
}

/**
* Implements hook_d7csp_hosts().
*/
function campaignion_tracking_ga4_d7csp_hosts() {
$hosts['connect-src'][] = '*.google-analytics.com';
return $hosts;
}

Check warning on line 49 in campaignion_tracking/campaignion_tracking_ga4/campaignion_tracking_ga4.module

View check run for this annotation

Codecov / codecov/patch

campaignion_tracking/campaignion_tracking_ga4/campaignion_tracking_ga4.module#L47-L49

Added lines #L47 - L49 were not covered by tests
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,12 @@ function campaignion_tracking_gtm_campaignion_tracking_snippets() {
return $exports;
}
}

/**
* Implements hook_d7csp_hosts().
*/
function campaignion_tracking_gtm_d7csp_hosts() {
$hosts['connect-src'][] = 'https://www.google.com';
$hosts['frame-src'][] = 'https://www.googletagmanager.com';
return $hosts;
}

Check warning on line 46 in campaignion_tracking/campaignion_tracking_gtm/campaignion_tracking_gtm.module

View check run for this annotation

Codecov / codecov/patch

campaignion_tracking/campaignion_tracking_gtm/campaignion_tracking_gtm.module#L43-L46

Added lines #L43 - L46 were not covered by tests

0 comments on commit 5b82d6e

Please sign in to comment.