LoginSignup
0
0

More than 3 years have passed since last update.

複数サイトのGoogle Analyticsを一括閲覧するブックマークレット

Posted at

https://analytics.google.com/analytics/web/
にアクセスしてから、下記のブックマークレットを実行します。

javascript:
    const root_path = 'https://analytics.google.com/analytics/web/#/report-home/';
    const h = window.innerHeight * 0.8;

    if(!document.location.href.match(/analytics.google.com/)){
        document.location.href = root_path;
    }

    let iframes = [
        { name: 'site_a', src: '44rw4rfsjlosk4ut4osgubsxlrutr' },
        { name: 'site_b', src: 'sw43roislfgvjslertkgvsdlguvsd'},
        { name: 'site_c', src: 'xserfswzr4wregvbdxfgvdser33gs' },
    ];

    $('body').attr('class', '').css({padding: '10px'}).empty();

    for (let i in iframes) {
        let iframe = iframes[i];

        $(`<h3>${iframe.name} <a id="${iframe.name}" name="${iframe.name}"></a></h3>`).appendTo('body');
        $('<div>').append($(`<iframe style="width:95%; height:${h}px; border:1px solid gray;">`).attr('src', root_path + iframe.src)).appendTo('body');
    }

srcの文字列は、アナリティクスのURLの最後につく文字列です。
こんな感じに、一括でiframe表示されますー
gazou.jpg

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0