Skip to content
Snippets Groups Projects
Commit e1f490f2 authored by Erick Hitter's avatar Erick Hitter
Browse files

Better building of settings output, also giving others all the freedom they...

Better building of settings output, also giving others all the freedom they need to add per the spec
parent 3e168622
Branches
Tags
1 merge request!1WIP: Initial release
...@@ -108,25 +108,23 @@ class ETH_AMP_Analytics_WP { ...@@ -108,25 +108,23 @@ class ETH_AMP_Analytics_WP {
* *
*/ */
public function action_amp_post_template_footer( $amp_template ) { public function action_amp_post_template_footer( $amp_template ) {
$triggers = array( $output = array(
'trackPageview' => array( 'vars' => array(
'on' => 'visible', 'account' => $this->get_option( 'property_id' ),
'request' => 'pageview', ),
'triggers' => array(
'trackPageview' => array(
'on' => 'visible',
'request' => 'pageview',
),
), ),
); );
$triggers = apply_filters( 'eth_amp_analytics_wp_ga_triggers', $triggers, $amp_template ); $output = apply_filters( 'eth_amp_analytics_wp_ga_settings_js', $output );
?> ?>
<amp-analytics type="googleanalytics" id="analytics1"> <amp-analytics type="googleanalytics" id="analytics1">
<script type="application/json"> <script type="application/json"><?php echo wp_json_encode( $output ); ?></script>
{
"vars": {
"account": "<?php echo esc_js( $this->options['property_id'] ); ?>"
},
"triggers": <?php wp_json_encode( $triggers ); ?>
}
</script>
</amp-analytics> </amp-analytics>
<?php <?php
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment