Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Becoming an AMP Analytics vendor #10539

Open
mrjoops opened this issue Sep 22, 2016 · 20 comments
Open

Becoming an AMP Analytics vendor #10539

mrjoops opened this issue Sep 22, 2016 · 20 comments
Labels
Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.

Comments

@mrjoops
Copy link

mrjoops commented Sep 22, 2016

AMP (Accelerated Mobile Pages) sites are gaining traction, and tracking data with this technology is a bit more complicated than with pure HTML/JS: https://www.ampproject.org/docs/reference/extended/amp-analytics.html

Sure we can use the pixel image fallback method for basic tracking, but what about becoming an AMP Analytics vendor ? This would be a great way to promote Piwik at a reasonable cost.

https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/integrating-analytics.md

@mattab
Copy link
Member

mattab commented Sep 22, 2016

Thank you @mrjoops for the great suggestion! we will definitely consider it as Piwik needs to be on this list. Google is pushing hard for AMP so this is becoming very important.

If you have knowledge or able to help on this, we would very much welcome your help 👍

@mrjoops
Copy link
Author

mrjoops commented Sep 23, 2016

The second link is worth a read, with example pull requests from Xiti and comScore, but I don't have the required Piwik knowledge to answer the questions raised in the document.

@mattab mattab added the Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Sep 26, 2016
@mattab mattab added this to the 3.0.0 milestone Sep 26, 2016
@FiloSottile
Copy link

FiloSottile commented Dec 8, 2016

There's no need to become a vendor (which probably wouldn't work with self-hosted instances). The JSON specifying the config can be specified by the AMP page (see docs).

<amp-analytics config="https://example.com/analytics.config.json"></amp-analytics>

The PIWIK instance could return a config generated based on the site configuration (like enabling link and timer handlers), and offer a simple snippet like the above for integration in one's AMP site.

In the meantime, an example JSON would also be useful and a valid intermediate iteration.

A more complete implementation would then use the variables to submit all the information in the URL even if custom Javascript can't be run.

@tsteur
Copy link
Member

tsteur commented Dec 8, 2016

It would be certainly nice to have in Piwik but looking through docs etc would take quite a while. Maybe someone can work out a JSON that could be used and we add later some logic? Also what is the easiest way to test the tracking? Ideally we would also report in the UI whether AMP was used. Something like this might work but I have not tested it:

<amp-analytics>
<script type="application/json">
{
  "requests": {
    "base": "https://example.com/analytics?a=${account}&u=${canonicalUrl}&t=${title}",
    "pageview": "${base}",
    "event": "${base}&e_c=${eventCategory}&e_n=${eventName}&e_a=${eventAction}"
  },
  "vars": {
    "idsite": "1"
  },
  "triggers": {
    "trackPageview": {
      "on": "visible",
      "request": "pageview"
    },
    "trackAnchorClicks": {
      "on": "click",
      "selector": "a",
      "request": "event",
      "vars": {
        "eventName": "42",
        "eventCategory": "link",
        "eventAction": "click"
      }
    }
  }
}
</script>
</amp-analytics>

@mattab
Copy link
Member

mattab commented Dec 15, 2016

There was an article written about AMP and Piwik: http://www.elftronix.com/guide-to-using-piwik-analytics-with-amp-on-wordpress/

@mattab
Copy link
Member

mattab commented Aug 7, 2017

If anyone can help adding support for AMP and issuing a pull request, it would be great 👍

@djallet
Copy link

djallet commented Aug 27, 2017

Mixing https://github.com/Automattic/amp-wp and http://www.elftronix.com/guide-to-using-piwik-analytics-with-amp-on-wordpress/ here is a way to use Piwik Pixel without modifying single.php of AMP :

add_action( 'amp_post_template_footer', 'xyz_amp_add_pixel' );
function xyz_amp_add_pixel( $amp_template ) {
    $post_id = $amp_template->get( 'post_id' );
    ?>
    <amp-pixel src=”//www.myawesomewebsite.com/piwik/piwik.php?idsite=[ID_NUMBER]&rec=1&action_name=TITLE&urlref=DOCUMENT_REFERRER&url=CANONICAL_URL&rand=RANDOM”></amp-pixel>
    <?php
}

@mrjoops
Copy link
Author

mrjoops commented Aug 28, 2017

I think some people are missing the point here. As I wrote in my opening post:

Sure we can use the pixel image fallback method for basic tracking, but what about becoming an AMP Analytics vendor ? This would be a great way to promote Piwik at a reasonable cost.

The point isn't only about making Piwik "just" work with AMP, the point is to make it work the good and easy way, and also promoting Piwik.
The pixel method is too limited, you lose too much information.
The @tsteur method may work (not tested) but it's not what I'd call easy.

[background-story]
In my company, AMP are mainly integrated and deployed by programmatically-unskilled people (some marketing-oriented "webmasters"). They can copy/paste a tag, but don't ask them to edit even some JSON. They publish contents on the web without much consideration for the underlying technical stuff.
How many times did I found a corporate web page with a GA tracker in it, while everything in our IT used Piwik, just because they didn't know that Piwik could work with it ? The answer is: way too much.
They are very kind people, they just don't want to know how Internet works, it just have to work. As a developer, my work is to make their lives easier (for better and for worse).
My company isn't alone in this case.
[/background-story]

So in the name of those people who think it won't work because it's not listed on https://www.ampproject.org/docs/guides/analytics/analytics-vendors, and because we want Piwik to be used by real people (not only the open-source/privacy nerds), please become an AMP analytics vendor.

@saitho
Copy link

saitho commented Nov 14, 2017

@mattab Are there any plans on AMP support for Piwik in the near future?

@mattab
Copy link
Member

mattab commented Nov 14, 2017

@saitho @mrjoops Yes, we'd love to support AMP, but we're lacking resources at the moment. Would anyone be willing to help and lead this effort? we can provide support but can't lead it ourselves at the moment. Thanks

@mrjoops
Copy link
Author

mrjoops commented Nov 15, 2017

I could probably take a deeper look at this, read all the docs and vendor submission procedures, elaborate on a plan and maybe hack a little before the end of the year, if it could help.

@sgiehl
Copy link
Member

sgiehl commented Nov 15, 2017

@mrjoops would be awesome if you could handle that. If you have any questions we can help with, feel free to ask :)

@ullahfahad
Copy link

Did any progress happen on this front? I am in the boat of integrating Matomo now and 30% of my traffic out of 2.0million monthly sessions comes from AMP pages.

@tsteur
Copy link
Member

tsteur commented Mar 27, 2019

We haven't worked on this ourselves but we'd provide any help if someone is keen to make progress on this.

@mattab
Copy link
Member

mattab commented Jun 5, 2019

FYI there was a post in the forums which possibly includes a solution: https://forum.matomo.org/t/how-to-add-piwik-to-amp-pages/18424/6

@mattab
Copy link
Member

mattab commented Feb 26, 2020

Another article for Matomo and AMP for WordPress: https://ampforwp.com/tutorials/article/how-to-add-matomo-piwik-analytics-in-amp/

@mattab
Copy link
Member

mattab commented Mar 2, 2020

What would be the effort to build AMP support for Matomo?

@mattab mattab removed this from the Priority Backlog (Help wanted) milestone Mar 2, 2020
@dannyeuu
Copy link

dannyeuu commented Nov 9, 2020

@mattab Any updates here?

@atom-box
Copy link

atom-box commented Mar 7, 2022

A user wrote, asking if Amp HTML is compatible with Matomo.

He sent a link of which of our peers are used with Amp:
https://amp.dev/documentation/guides-and-tutorials/optimize-and-measure/configure-analytics/analytics-vendors/

I see several of the tags are different:
https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml/

@tsteur
Copy link
Member

tsteur commented Dec 7, 2023

Hello, if anyone is still interested in this please comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests