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
Commits
3bc7439b
Commit
3bc7439b
authored
9 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
PHPDoc and minor cleanup
parent
bdcfbfa5
Branches
Branches containing commit
No related tags found
1 merge request
!1
WIP: Initial release
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
eth-amp-analytics-wp.php
+14
-9
14 additions, 9 deletions
eth-amp-analytics-wp.php
with
14 additions
and
9 deletions
eth-amp-analytics-wp.php
+
14
−
9
View file @
3bc7439b
...
...
@@ -23,6 +23,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
ETH_AMP_Analytics_WP
{
/**
* PLUGIN SETUP
*/
/**
* Singleton
*/
...
...
@@ -75,7 +79,7 @@ class ETH_AMP_Analytics_WP {
}
/**
*
*
Clean up plugin data when it's removed
*/
public
static
function
uninstall
()
{
delete_option
(
'eth_amp_analytics_wp'
);
...
...
@@ -96,15 +100,16 @@ class ETH_AMP_Analytics_WP {
*/
/**
* Add component script to header
*
* Must appear before AMP JS library, per https://developers.google.com/analytics/devguides/collection/amp-analytics/
*/
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
?>
<script
async
custom-element=
"amp-analytics"
src=
"https://cdn.ampproject.org/v0/amp-analytics-0.1.js"
></script>
<?php
}
/**
*
*
Add GA settings to post body
*/
public
function
action_amp_post_template_footer
(
$amp_template
)
{
$output
=
array
(
...
...
@@ -133,7 +138,7 @@ class ETH_AMP_Analytics_WP {
*/
/**
*
*
Register admin additions
*/
public
function
action_admin_init
()
{
register_setting
(
'reading'
,
$this
->
plugin_option_name
,
array
(
$this
,
'sanitize_options'
)
);
...
...
@@ -143,7 +148,7 @@ class ETH_AMP_Analytics_WP {
}
/**
*
*
Render Property ID input field
*/
public
function
settings_field_property_id
()
{
?>
...
...
@@ -156,7 +161,7 @@ class ETH_AMP_Analytics_WP {
}
/**
*
*
Sanitize options
*/
public
function
sanitize_options
(
$options
)
{
$sanitized_options
=
$this
->
plugin_option_defaults
;
...
...
@@ -185,7 +190,7 @@ class ETH_AMP_Analytics_WP {
*/
/**
*
*
Retrieve one of the plugin's options
*/
private
function
get_option
(
$name
)
{
// Prepare options if this is the first request
...
...
@@ -210,4 +215,4 @@ class ETH_AMP_Analytics_WP {
}
}
ETH_AMP_Analytics_WP
::
get_instance
();
\ No newline at end of file
ETH_AMP_Analytics_WP
::
get_instance
();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment