Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
ETH Google Analytics for AMP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
WP Plugins
ETH Google Analytics for AMP
Merge requests
!1
WIP: Initial release
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
WIP: Initial release
develop
into
master
Overview
2
Commits
20
Changes
1
Closed
Erick Hitter
requested to merge
develop
into
master
9 years ago
Overview
2
Commits
20
Changes
1
Expand
0
0
Merge request reports
Viewing commit
bdcfbfa5
Prev
Next
Show latest version
1 file
+
4
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
bdcfbfa5
Correct how JS library is loaded
· bdcfbfa5
Erick Hitter
authored
9 years ago
eth-amp-analytics-wp.php
+
4
−
5
Options
@@ -86,7 +86,7 @@ class ETH_AMP_Analytics_WP {
*/
public
function
action_wp_loaded
()
{
if
(
!
empty
(
$this
->
get_option
(
'property_id'
)
)
)
{
add_
filter
(
'amp_
component_scripts'
,
array
(
$this
,
'filter_amp_component_scripts'
)
);
add_
action
(
'amp_
post_template_head'
,
array
(
$this
,
'action_amp_post_template_head'
),
5
);
// Must appear before the AMP JS library
add_action
(
'amp_post_template_footer'
,
array
(
$this
,
'action_amp_post_template_footer'
)
);
}
}
@@ -98,10 +98,9 @@ class ETH_AMP_Analytics_WP {
/**
*
*/
public
function
filter_amp_component_scripts
(
$scripts
)
{
$scripts
[
'amp-analytics'
]
=
'https://cdn.ampproject.org/v0/amp-analytics-0.1.js'
;
return
$scripts
;
public
function
action_amp_post_template_head
(
$scripts
)
{
?>
<script
async
custom-element=
"amp-analytics"
src=
"https://cdn.ampproject.org/v0/amp-analytics-0.1.js"
></script>
<?php
}
/**
Loading