openfoodfoundation / openfoodnetwork

Connect suppliers, distributors and consumers to trade local produce.
https://www.openfoodnetwork.org
GNU Affero General Public License v3.0
1.1k stars 713 forks source link

[Matomo] Goals/funnels broken after removing general tracking code #9818

Closed filipefurtad0 closed 1 year ago

filipefurtad0 commented 1 year ago

Description

Goals/funnels broken after removing general tracking code.

Expected Behavior

Goals and funnels should work as before, after the removal of the general tracking code.

Actual Behaviour

Goals/funnels broken after removing general tracking code.

Steps to Reproduce

Prod or staging test

  1. Set up a goal
  2. Assure it is triggered -> currently failing
  3. Change those settings to contain funnels
  4. Check the Funnels section and try to get out meaningful readings -> currently failing (no goals, hence no funnels!)

Animated Gif/Screenshot

-

Workaround

-

Severity

bug-s2: a non-critical feature is broken, no workaround

Your Environment

Possible Fix

Setting goals using Tags

filipefurtad0 commented 1 year ago

An S2 according to our processes, but maybe best to keep this one out of the In Dev column as I doubt it will require any changes in our code base - it should be a configuration issue. I've assigned myself.

RachL commented 1 year ago

@filipefurtad0 I don't know if usefull, or overkill, but perhaps we need a repo for analytics issues?

filipefurtad0 commented 1 year ago

Hum, not sure we need a new repo :shrug:

Between a new Analytics column on our main repo or a shiny new one: which one do you think it would make more sense?

Having a new repo for Analytics could allow to combine it the occasional need to make specific metabase/DB queries. So, for example, when anyone needs a query we could open issues in this repo, and have the SQL queries addressing it.

Thoughts?

filipefurtad0 commented 1 year ago

Ok, as far as I could gather from my last interaction with customer support (transcribing):

In the standard tracking code there is this particular entry (below) in the code to push the page view

_paq.push(['trackPageView']);

Looking at your Tag Manager you do have some triggers for button click and order confirmation, what you need is a tag that triggers on any page view to duplicate the action above. You do have a similar trigger configured already (below screenshot) but it will only fire on the 'check out' page, so if you can create a trigger for 'page view' with no "optional" triggers it should push all page views.

Ok, so, having:

  1. created a general trigger (optional part left empty):

image

  1. And creating an tag for this trigger:

image

Appending the preview code snippet on the URL and reloading the page seems to trigger the page view:

image

To do: Still left to test is whether this correctly triggers the respective goals.

filipefurtad0 commented 1 year ago

Alright - goals and funnels are back (on staging) :tada:

Goals

image

Funnels

image

So, as a summary, we need:

Ping @BethanOFN - this should fix it. Once you've tried it in UK-production could you please drop me a line, if it worked out? I'll close the issue then. Please reach out if there is anything unclear - thank you!

BethanOFN commented 1 year ago

@filipefurtad0 I just need to check tomorrow once stats update to ensure that each goal is working correctly - I've got all of them working bar one so far, will update once finished thank you 👍

BethanOFN commented 1 year ago

@filipefurtad0 Bingo all working, thank you!

filipefurtad0 commented 1 year ago

Very happy to hear! Thank you so much for your feedback @BethanOFN :pray:

filipefurtad0 commented 1 year ago

This seems not to be working yet for FR-prod. Re-opening.

image

filipefurtad0 commented 1 year ago

Hum, so this does work in FR prod, but only for browsers explicitly allowing tracking - below Chrome, with the Tag set in debug mode:

image

filipefurtad0 commented 1 year ago

I believe this is happening because FR-prod requires tracking consent, but has cookie banner disabled on the respective variable named Matomo Configuration (OFN FR) - below, left:

image

If we don't have the cookie banner appearing for FR-prod, then I think we should disable the Require tracking consent, right @RachL ?

RachL commented 1 year ago

Hmmmm the guidelines I've followed in https://github.com/openfoodfoundation/wishlist/issues/1 don't mention this, but I guess it makes sense! Good catch:)

filipefurtad0 commented 1 year ago

We need to pin that post somewhere :-) https://github.com/openfoodfoundation/wishlist/issues/1 - I was looking for it before but could not find it.

Anyway, I think we're back on track: image

Closing.