• Resolved asafm7

    (@asafm7)


    Hi,

    I’m using Google Optimize with AMP (official plugin).

    All is set up in Optimize including the AMP experiment settings JSON.

    My question is, do I need in addition to manually send experiments data to Google Analytics, or is it taken care of by Google Site Kit? I refer to the part here in the section “Example 2: <amp-analytics>”:
    https://developers.google.com/optimize/devguides/amp-experiments

    Thanks.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    Hi @asafm7,

    Great question. You do need to have Analytics setup on your site for experiments although you don’t need to manually setup any Optimize specific experiment data. Once Google Analytics is active on your site that’s enough.

    Let me know if you have any further questions on this. You may also find the Optimize Resource Hub useful for more product specific queries.

    Thread Starter asafm7

    (@asafm7)

    Hi,

    Thanks, but things don’t seem to work. I don’t see data in Google Optimize or Google Analytics.

    Is Site Kit compatible with multiple concurrence experiments? For example:

    {
        "join-newsletter-menu-item-font-weight": {
            "sticky": true,
            "variants": {
                "0": 50,
                "1": 50
            }
        },
        "books-instructions-order": {
            "sticky": true,
            "variants": {
                "0": 50,
                "1": 50
            }
        }
    }
    Plugin Support James Osborne

    (@jamesosborne)

    Thanks for the update. If your experiment is not working as expected you may be best served asking the product experts at the Optimize Help Center. Site Kit provides the facility to insert experiment data and associate it with a container we don’t have as much insights into troubleshooting specific experimental data as the Optimize team would.

    Is Site Kit compatible with multiple concurrence experiments?

    Optimize is compatible with multiple experiments, not specifically Site Kit. The Site Kit plugin facilities the placement of experiments.

    Sorry we can’t be of more assistance on this.

    Thread Starter asafm7

    (@asafm7)

    Thanks.

    It seems to me I’m missing something.

    – I have AMP on standard mode
    – I have Google Optimize set up using Site Kit

    – I don’t see any reference to Google Optimize container ID on my rendered AMP pages.
    – I do see <amp-experiment> element

    If this setup is proper, how does the data of the experiments suppose to flow to Google Optimize?

    Hello @asafm7 ,

    Would you mind to share your website URL so we can only check the snippet? Unfortunately we are only limited to snippet placement check as this is more relevant to the product experts at Optimize Help Center.

    Best Regards,

    Thread Starter asafm7

    (@asafm7)

    Hi,

    I don’t think a Google Optimize is snippet is supposed to be placed in AMP pages.

    The data is sent using a dedicated <amp-analytics> component, as described here (Example 2):
    https://developers.google.com/optimize/devguides/amp-experiments

    I added the <amp-analytics> component and everything workes as expected.

    This was my original question – is there a need to add such a component, or does Site Kit takes care of it.

    Although you answered there is no need to add it, it seems to be wrong – there is a need.

    If all I described is correct, maybe you will want to consider adding a feature to Site Kit to take care of it automatically.

    Thanks

    Plugin Support James Osborne

    (@jamesosborne)

    Many thanks for your patience on this. I’ve done some more testing and I don’t see any issues with inserting AM experiment data when using the official AMP plugin.

    I don’t think a Google Optimize is snippet is supposed to be placed in AMP pages.

    The snippet is placed if defined within Site Kit. If you’re finding the snippet does not appear on your AMP URLs please share your site URL and I can check your setup.

    I added the <amp-analytics> component and everything workes as expected.

    This may be where the confusion lies. If you’ve allowed Site Kit to insert your Analytics snippet the plugin will insert your snippet on both your canonical (non AMP) and also your AMP URLs. For your AMP URLs it will use the correct amp-analytics version.

    Let me know if you have any further queries on this.

    Thread Starter asafm7

    (@asafm7)

    Hi @jamesosborne ,

    Yes, the JSON is there.

    But how does the data flow to Google Optimize?

    The <amp-experiment> JSON is only part of the system. By itself, it doesn’t communicate with Google Optimize

    As the documentation describe, the data needs to be sent to Google Analytics (and from there to Google Optimize I guess) using a dedicated “experiment” request:

    "requests": {
         "experiment": "${pageview}&xid=${xid}&xvar=${xvar}"
      },
      "triggers": {
        "trackPageview": {
          "on": "visible",
          "request": "experiment",
           "vars": {
             "xid": "gaExperimentID",
             "xvar": "VARIANT(experimentName)"
           }
        }
      }

    The Analytics snippet inserted by Site Kit (and I do allow it to be inserted) doesn’t include this “experiment” request.

    Please try to set up an experiment on an AMP page using Site Kit only and check if you see any traffic recorded on Google Optimize.

    Make sure the site is all-AMP so you won’t confuse traffic from non-AMP pages.

    This is my site:
    https://eyalshifroni.com/

    This is a screenshot of my Site Kit Google Optimize setup:

    flameshot_screenshot

    • This reply was modified 3 years, 5 months ago by asafm7.
    Plugin Support James Osborne

    (@jamesosborne)

    Thanks for the update. While Site Kit can be used to insert your Google Analytics snippet you can also insert your own Google Analytics snippet, or insert your Analytics snippet using the AMP plugin – which Site Kit can recognize (demonstration). This may be the best solution in your case if you’re looking to make modifications to the snippet as placed via Site Kit, something we don’t support.

    If using the AMP plugins Analytics feature to insert your amp-analytics snippet with Optimize experimental data please be sure to include googleanalytics as the type, as you’ll find in the amp-experiment AMP playground.

    With the above approach you should be able to setup an experiment as per the referenced amp-experiment playground, using similar markup for testing purposes (after setting up via Optimize and obtaining your experiment ID)

    I’ll also answer your above questions to best of my ability:

    But how does the data flow to Google Optimize?

    Providing you have a connected amp-analytics tag that is already associated with your experiment that is enough for data to flow between both services.

    The Analytics snippet inserted by Site Kit (and I do allow it to be inserted) doesn’t include this “experiment” request.

    As we don’t support modifying the Site Kit placed Analytics snippet please follow the demonstration video as provided above in order to setup amp-analytics with your own JSON configurations for amp-analytics.

    Hopefully the above provides some assistance. If you find your experiments are not working please reach out to the Optimize Help Center, where the product experts would have better insights than we do here in Site Kit plugin support. Please also test using the snippets as per the amp-experiment playground.

    Thread Starter asafm7

    (@asafm7)

    Sorry, but I’m not sure I’m following.

    I don’t need help with setting things up manually (as I mentioned, I already did, and it’s working).

    All I want to understand is if I NEED to set up things manually.

    You make it sounds like I don’t need to, and things are supposed to work out-of-the-box – this is what I don’t understand.

    Providing you have a connected amp-analytics tag that is already associated with your experiment that is enough for data to flow between both services.

    I don’t believe it is true, this is my point. Anyway, I did connect amp-analytics and things weren’t working.

    As far as I understand, this is not related to Google Optimize. You (Site Kit) are providing a way to integrate with Google Optimize – but it is actually missing a link. There is nothing Google Optimize can do about it.

    Can you please answer these yes/no question:

    1. Is it possible to set up a working AMP Google Optimize experiment using only Site Kit, without any further manual addition?
    2. Were you able to set up a working AMP Google Optimize experiment using only Site Kit, without any further manual addition?

    Thanks

    Thread Starter asafm7

    (@asafm7)

    It seems that although Site Kit says the Google Analytics snippet is inserted:

    flameshot_screenshot

    There is no <amp-analytics> of googleanalytics type in the page. Only a gtag type:

    flameshot_screenshot

    Maybe this is the cause of the issue/confusion?

    Plugin Support James Osborne

    (@jamesosborne)

    Apologys if I haven’t been understanding your query. I did perform various tests and yes, experiments will work with only Site Kit for AMP URLs. The only thing I noticed that doesn’t work as expected in the “Check Installation” button within Optimize on the experiments page, although this is more an Optimize service limitation and not specific to Site Kit.

    Here are the steps I followed on a standard mode AMP site if you want to try yourself:

    1. I setup the experiment within Optimize, an A/B test with Page views as the objective
    2. I inserted my Analytics snippet manually into my theme files (using a modification of this snippet from the amp experiment component playground)
    3. I then connected the Analytics module within Site Kit. The plugin as expected recognized this Analytics snippet and therefore didn’t place it’s own the Analytics snippet – instead using my manually place snippet with experiment code
    4. I then connected the Optimize module (screenshot with code snippet from the same amp-experiment playground)
    5. I then started the experiment within Optimize
    6. I then visited my standard mode AMP site and checked the real time active users, with the experiment working as expected

    Note that in all the above I used my own Optimize container ID and Experiment ID. Be sure to change this to match your own.

    So summarize and answer your queries see below:

    Is it possible to set up a working AMP Google Optimize experiment using only Site Kit, without any further manual addition?

    Yes. Please insert your Analytics snippet manually (which Site Kit can recognize) with any modifications you wish for amp-analytics.

    Were you able to set up a working AMP Google Optimize experiment using only Site Kit, without any further manual addition?

    Yes. See example demonstration in this video. An AMP site with a basic experiment.

    While I’m unsure of the experiment you’re setting up some default experiments may not work in AMP as they do in non AMP. A banner experiment for example is not fully AMP compatible from the last time I checked. If you’re looking to use experiments on your AMP site please perform some tests and if you’re unsure the Optimize Help Center should be able to assist better than we can here. Site Kit alone can be used for AMP experiments – when using the official AMP plugin. You may however need to insert your own Analytics snippets manually.

    Plugin Support James Osborne

    (@jamesosborne)

    Just in relation to your last query you only need to enter the googleanalytics type if using the AMP plugins in built Analytics feature. This is to identify Google Analytics as the vendor (with multiple other vendors supporting amp-analytics.

    If you’ve allowed Site Kit to insert your snippet then Site Kit uses a gtag implementation as you referenced. They both point to Google Analytics.

    Thread Starter asafm7

    (@asafm7)

    Thank you very much for the detailed response.

    I believe we have a gap in the terminology.

    In my view, your step 2 (manually inserting Analytics snippet) is out of the scope of Site Kit, and hence the answer is “no” – you can’t perform an AMP Google Optimize experiment using only Sit Kit.

    Anyway, my original question, and all I wanted to figure out, is if step 2 is a must. As I understand – your steps confirm it is a must.

    Your original answer was:

    you don’t need to manually setup any Optimize specific experiment data.

    Step 2 you described contradicts this.

    Anyway, now that we established that a manual addition of a modified <amp-analytics> is a must, all is left for me is to suggest a Site Kit feature that will handle it automatically ??

    Plugin Support James Osborne

    (@jamesosborne)

    No problem at all. You’re correct that after reviewing the procedure it does seem it is required that users add experiment ID’s to an AMP Analytics snippet. This must be inserted manually alongside an amp-analytics snippet. This is not something that can be added at present by configurations to the Site Kit Analytics module. Sorry for the initial confusion.

    Anyway, now that we established that a manual addition of a modified <amp-analytics> is a must, all is left for me is to suggest a Site Kit feature that will handle it automatically ??

    Feel free to submit a feature request on the plugins GitHub repository. At present from testing I can see how it is a complex process.

    Alternatively you may also wish to chime in on the GitHub issue below, with references to setting up experiments for AMP URLs:
    https://github.com/google/site-kit-wp/issues/1628

    There is also a separate GitHub issue in relation to the Analytics integration with experiment IDs in AMP which you may be interested in. Feel free to leave your comments in there for the team to review, I’m happy to discuss with them also.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘AMP with Optimize’ is closed to new replies.