Recherche avancée

Médias (91)

Autres articles (79)

  • Participer à sa documentation

    10 avril 2011

    La documentation est un des travaux les plus importants et les plus contraignants lors de la réalisation d’un outil technique.
    Tout apport extérieur à ce sujet est primordial : la critique de l’existant ; la participation à la rédaction d’articles orientés : utilisateur (administrateur de MediaSPIP ou simplement producteur de contenu) ; développeur ; la création de screencasts d’explication ; la traduction de la documentation dans une nouvelle langue ;
    Pour ce faire, vous pouvez vous inscrire sur (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

Sur d’autres sites (6941)

  • How to generate a fixed duration and fps for a video using FFmpeg C++ libraries ? [closed]

    4 novembre 2024, par BlueSky Light Programmer

    I'm following the mux official example to write a C++ class that generates a video with a fixed duration (5s) and a fixed fps (60). For some reason, the duration of the output video is 3-4 seconds, although I call the function to write frames 300 times and set the fps to 60.

    


    Can you take a look at the code below and spot what I'm doing wrong ?

    


    #include "ffmpeg.h"&#xA;&#xA;#include <iostream>&#xA;&#xA;static int writeFrame(AVFormatContext *fmt_ctx, AVCodecContext *c,&#xA;                      AVStream *st, AVFrame *frame, AVPacket *pkt);&#xA;&#xA;static void addStream(OutputStream *ost, AVFormatContext *formatContext,&#xA;                      const AVCodec **codec, enum AVCodecID codec_id,&#xA;                      int width, int height, int fps);&#xA;&#xA;static AVFrame *allocFrame(enum AVPixelFormat pix_fmt, int width, int height);&#xA;&#xA;static void openVideo(AVFormatContext *formatContext, const AVCodec *codec,&#xA;                      OutputStream *ost, AVDictionary *opt_arg);&#xA;&#xA;static AVFrame *getVideoFrame(OutputStream *ost,&#xA;                              const std::vector<glubyte>&amp; pixels,&#xA;                              int duration);&#xA;&#xA;static int writeVideoFrame(AVFormatContext *formatContext,&#xA;                           OutputStream *ost,&#xA;                           const std::vector<glubyte>&amp; pixels,&#xA;                           int duration);&#xA;&#xA;static void closeStream(AVFormatContext *formatContext, OutputStream *ost);&#xA;&#xA;static void fillRGBImage(AVFrame *frame, int width, int height,&#xA;                         const std::vector<glubyte>&amp; pixels);&#xA;&#xA;#ifdef av_err2str&#xA;#undef av_err2str&#xA;#include <string>&#xA;av_always_inline std::string av_err2string(int errnum) {&#xA;  char str[AV_ERROR_MAX_STRING_SIZE];&#xA;  return av_make_error_string(str, AV_ERROR_MAX_STRING_SIZE, errnum);&#xA;}&#xA;#define av_err2str(err) av_err2string(err).c_str()&#xA;#endif  // av_err2str&#xA;&#xA;FFmpeg::FFmpeg(int width, int height, int fps, const char *fileName)&#xA;: videoStream{ 0 }&#xA;, formatContext{ nullptr } {&#xA;  const AVOutputFormat *outputFormat;&#xA;  const AVCodec *videoCodec{ nullptr };&#xA;  AVDictionary *opt{ nullptr };&#xA;  int ret{ 0 };&#xA;&#xA;  av_dict_set(&amp;opt, "crf", "17", 0);&#xA;&#xA;  /* Allocate the output media context. */&#xA;  avformat_alloc_output_context2(&amp;this->formatContext, nullptr, nullptr, fileName);&#xA;  if (!this->formatContext) {&#xA;    std::cout &lt;&lt; "Could not deduce output format from file extension: using MPEG." &lt;&lt; std::endl;&#xA;    avformat_alloc_output_context2(&amp;this->formatContext, nullptr, "mpeg", fileName);&#xA;  &#xA;    if (!formatContext)&#xA;      exit(-14);&#xA;  }&#xA;&#xA;  outputFormat = this->formatContext->oformat;&#xA;&#xA;  /* Add the video stream using the default format codecs&#xA;   * and initialize the codecs. */&#xA;  if (outputFormat->video_codec == AV_CODEC_ID_NONE) {&#xA;    std::cout &lt;&lt; "The output format doesn&#x27;t have a default codec video." &lt;&lt; std::endl;&#xA;    exit(-15);&#xA;  }&#xA;&#xA;  addStream(&#xA;    &amp;this->videoStream,&#xA;    this->formatContext,&#xA;    &amp;videoCodec,&#xA;    outputFormat->video_codec,&#xA;    width,&#xA;    height,&#xA;    fps&#xA;  );&#xA;  openVideo(this->formatContext, videoCodec, &amp;this->videoStream, opt);&#xA;  av_dump_format(this->formatContext, 0, fileName, 1);&#xA;  &#xA;  /* open the output file, if needed */&#xA;  if (!(outputFormat->flags &amp; AVFMT_NOFILE)) {&#xA;    ret = avio_open(&amp;this->formatContext->pb, fileName, AVIO_FLAG_WRITE);&#xA;    if (ret &lt; 0) {&#xA;      std::cout &lt;&lt; "Could not open &#x27;" &lt;&lt; fileName &lt;&lt; "&#x27;: " &lt;&lt; std::string{ av_err2str(ret) } &lt;&lt; std::endl;&#xA;      exit(-16);&#xA;    }&#xA;  }&#xA;&#xA;  /* Write the stream header, if any. */&#xA;  ret = avformat_write_header(this->formatContext, &amp;opt);&#xA;  if (ret &lt; 0) {&#xA;    std::cout &lt;&lt; "Error occurred when opening output file: " &lt;&lt; av_err2str(ret) &lt;&lt; std::endl;&#xA;    exit(-17);&#xA;  }&#xA;&#xA;  av_dict_free(&amp;opt);&#xA;}&#xA;&#xA;FFmpeg::~FFmpeg() {&#xA;  if (this->formatContext) {&#xA;    /* Close codec. */&#xA;    closeStream(this->formatContext, &amp;this->videoStream);&#xA;&#xA;    if (!(this->formatContext->oformat->flags &amp; AVFMT_NOFILE)) {&#xA;      /* Close the output file. */&#xA;      avio_closep(&amp;this->formatContext->pb);&#xA;    }&#xA;&#xA;    /* free the stream */&#xA;    avformat_free_context(this->formatContext);&#xA;  }&#xA;}&#xA;&#xA;void FFmpeg::Record(&#xA;  const std::vector<glubyte>&amp; pixels,&#xA;  unsigned frameIndex,&#xA;  int duration,&#xA;  bool isLastIndex&#xA;) {&#xA;  static bool encodeVideo{ true };&#xA;  if (encodeVideo)&#xA;    encodeVideo = !writeVideoFrame(this->formatContext,&#xA;                                   &amp;this->videoStream,&#xA;                                   pixels,&#xA;                                   duration);&#xA;&#xA;  if (isLastIndex) {&#xA;    av_write_trailer(this->formatContext);&#xA;    encodeVideo = false;&#xA;  }&#xA;}&#xA;&#xA;int writeFrame(AVFormatContext *fmt_ctx, AVCodecContext *c,&#xA;               AVStream *st, AVFrame *frame, AVPacket *pkt) {&#xA;  int ret;&#xA;&#xA;  // send the frame to the encoder&#xA;  ret = avcodec_send_frame(c, frame);&#xA;  if (ret &lt; 0) {&#xA;    std::cout &lt;&lt; "Error sending a frame to the encoder: " &lt;&lt; av_err2str(ret) &lt;&lt; std::endl;&#xA;    exit(-2);&#xA;  }&#xA;&#xA;  while (ret >= 0) {&#xA;    ret = avcodec_receive_packet(c, pkt);&#xA;    if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;      break;&#xA;    else if (ret &lt; 0) {&#xA;      std::cout &lt;&lt; "Error encoding a frame: " &lt;&lt; av_err2str(ret) &lt;&lt; std::endl;&#xA;      exit(-3);&#xA;    }&#xA;&#xA;    /* rescale output packet timestamp values from codec to stream timebase */&#xA;    av_packet_rescale_ts(pkt, c->time_base, st->time_base);&#xA;    pkt->stream_index = st->index;&#xA;&#xA;    /* Write the compressed frame to the media file. */&#xA;    ret = av_interleaved_write_frame(fmt_ctx, pkt);&#xA;    /* pkt is now blank (av_interleaved_write_frame() takes ownership of&#xA;     * its contents and resets pkt), so that no unreferencing is necessary.&#xA;     * This would be different if one used av_write_frame(). */&#xA;    if (ret &lt; 0) {&#xA;      std::cout &lt;&lt; "Error while writing output packet: " &lt;&lt; av_err2str(ret) &lt;&lt; std::endl;&#xA;      exit(-4);&#xA;    }&#xA;  }&#xA;&#xA;  return ret == AVERROR_EOF ? 1 : 0;&#xA;}&#xA;&#xA;void addStream(OutputStream *ost, AVFormatContext *formatContext,&#xA;               const AVCodec **codec, enum AVCodecID codec_id,&#xA;               int width, int height, int fps) {&#xA;  AVCodecContext *c;&#xA;  int i;&#xA;&#xA;  /* find the encoder */&#xA;  *codec = avcodec_find_encoder(codec_id);&#xA;  if (!(*codec)) {&#xA;    std::cout &lt;&lt; "Could not find encoder for " &lt;&lt; avcodec_get_name(codec_id) &lt;&lt; "." &lt;&lt; std::endl;&#xA;    exit(-5);&#xA;  }&#xA;&#xA;  ost->tmpPkt = av_packet_alloc();&#xA;  if (!ost->tmpPkt) {&#xA;    std::cout &lt;&lt; "Could not allocate AVPacket." &lt;&lt; std::endl;&#xA;    exit(-6);&#xA;  }&#xA;&#xA;  ost->st = avformat_new_stream(formatContext, nullptr);&#xA;  if (!ost->st) {&#xA;    std::cout &lt;&lt; "Could not allocate stream." &lt;&lt; std::endl;&#xA;    exit(-7);&#xA;  }&#xA;&#xA;  ost->st->id = formatContext->nb_streams-1;&#xA;  c = avcodec_alloc_context3(*codec);&#xA;  if (!c) {&#xA;    std::cout &lt;&lt; "Could not alloc an encoding context." &lt;&lt; std::endl;&#xA;    exit(-8);&#xA;  }&#xA;  ost->enc = c;&#xA;&#xA;  switch ((*codec)->type) {&#xA;  case AVMEDIA_TYPE_VIDEO:&#xA;    c->codec_id = codec_id;&#xA;    c->bit_rate = 6000000;&#xA;    /* Resolution must be a multiple of two. */&#xA;    c->width    = width;&#xA;    c->height   = height;&#xA;    /* timebase: This is the fundamental unit of time (in seconds) in terms&#xA;      * of which frame timestamps are represented. For fixed-fps content,&#xA;      * timebase should be 1/framerate and timestamp increments should be&#xA;      * identical to 1. */&#xA;    ost->st->time_base = { 1, fps };&#xA;    c->time_base       = ost->st->time_base;&#xA;    c->framerate       = { fps, 1 };&#xA;&#xA;    c->gop_size      = 0; /* emit one intra frame every twelve frames at most */&#xA;    c->pix_fmt       = AV_PIX_FMT_YUV420P;&#xA;    if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) {&#xA;      /* just for testing, we also add B-frames */&#xA;      c->max_b_frames = 2;&#xA;    }&#xA;    if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO) {&#xA;      /* Needed to avoid using macroblocks in which some coeffs overflow.&#xA;      *  This does not happen with normal video, it just happens here as&#xA;      *  the motion of the chroma plane does not match the luma plane.*/&#xA;      c->mb_decision = 2;&#xA;    }&#xA;    break;&#xA;&#xA;  default:&#xA;    break;&#xA;  }&#xA;&#xA;  /* Some formats want stream headers to be separate. */&#xA;  if (formatContext->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;    c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;}&#xA;&#xA;AVFrame *allocFrame(enum AVPixelFormat pix_fmt, int width, int height) {&#xA;  AVFrame *frame{ av_frame_alloc() };&#xA;  int ret;&#xA;&#xA;  if (!frame)&#xA;    return nullptr;&#xA;&#xA;  frame->format = pix_fmt;&#xA;  frame->width  = width;&#xA;  frame->height = height;&#xA;&#xA;  /* allocate the buffers for the frame data */&#xA;  ret = av_frame_get_buffer(frame, 0);&#xA;  if (ret &lt; 0) {&#xA;    std::cout &lt;&lt; "Could not allocate frame data." &lt;&lt; std::endl;&#xA;    exit(-8);&#xA;  }&#xA;&#xA;  return frame;&#xA;}&#xA;&#xA;void openVideo(AVFormatContext *formatContext, const AVCodec *codec,&#xA;               OutputStream *ost, AVDictionary *opt_arg) {&#xA;  int ret;&#xA;  AVCodecContext *c{ ost->enc };&#xA;  AVDictionary *opt{ nullptr };&#xA;&#xA;  av_dict_copy(&amp;opt, opt_arg, 0);&#xA;&#xA;  /* open the codec */&#xA;  ret = avcodec_open2(c, codec, &amp;opt);&#xA;  av_dict_free(&amp;opt);&#xA;  if (ret &lt; 0) {&#xA;    std::cout &lt;&lt; "Could not open video codec: " &lt;&lt; av_err2str(ret) &lt;&lt; std::endl;&#xA;    exit(-9);&#xA;  }&#xA;&#xA;  /* Allocate and init a re-usable frame. */&#xA;  ost->frame = allocFrame(c->pix_fmt, c->width, c->height);&#xA;  if (!ost->frame) {&#xA;    std::cout &lt;&lt; "Could not allocate video frame." &lt;&lt; std::endl;&#xA;    exit(-10);&#xA;  }&#xA;&#xA;  /* If the output format is not RGB24, then a temporary RGB24&#xA;   * picture is needed too. It is then converted to the required&#xA;   * output format. */&#xA;  ost->tmpFrame = nullptr;&#xA;  if (c->pix_fmt != AV_PIX_FMT_RGB24) {&#xA;    ost->tmpFrame = allocFrame(AV_PIX_FMT_RGB24, c->width, c->height);&#xA;    if (!ost->tmpFrame) {&#xA;      std::cout &lt;&lt; "Could not allocate temporary video frame." &lt;&lt; std::endl;&#xA;      exit(-11);&#xA;    }&#xA;  }&#xA;&#xA;  /* Copy the stream parameters to the muxer. */&#xA;  ret = avcodec_parameters_from_context(ost->st->codecpar, c);&#xA;  if (ret &lt; 0) {&#xA;    std::cout &lt;&lt; "Could not copy the stream parameters." &lt;&lt; std::endl;&#xA;    exit(-12);&#xA;  }&#xA;}&#xA;&#xA;AVFrame *getVideoFrame(OutputStream *ost,&#xA;                       const std::vector<glubyte>&amp; pixels,&#xA;                       int duration) {&#xA;  AVCodecContext *c{ ost->enc };&#xA;&#xA;  /* check if we want to generate more frames */&#xA;  if (av_compare_ts(ost->nextPts, c->time_base,&#xA;                    duration, { 1, 1 }) > 0) {&#xA;    return nullptr;&#xA;  }&#xA;&#xA;  /* when we pass a frame to the encoder, it may keep a reference to it&#xA;    * internally; make sure we do not overwrite it here */&#xA;  if (av_frame_make_writable(ost->frame) &lt; 0) {&#xA;    std::cout &lt;&lt; "It wasn&#x27;t possible to make frame writable." &lt;&lt; std::endl;&#xA;    exit(-12);&#xA;  }&#xA;&#xA;  if (c->pix_fmt != AV_PIX_FMT_RGB24) {&#xA;      /* as we only generate a YUV420P picture, we must convert it&#xA;        * to the codec pixel format if needed */&#xA;      if (!ost->swsContext) {&#xA;        ost->swsContext = sws_getContext(c->width, c->height,&#xA;                                         AV_PIX_FMT_RGB24,&#xA;                                         c->width, c->height,&#xA;                                         c->pix_fmt,&#xA;                                         SWS_BICUBIC, nullptr, nullptr, nullptr);&#xA;        if (!ost->swsContext) {&#xA;          std::cout &lt;&lt; "Could not initialize the conversion context." &lt;&lt; std::endl;&#xA;          exit(-13);&#xA;        }&#xA;      }&#xA;&#xA;      fillRGBImage(ost->tmpFrame, c->width, c->height, pixels);&#xA;      sws_scale(ost->swsContext, (const uint8_t * const *) ost->tmpFrame->data,&#xA;                ost->tmpFrame->linesize, 0, c->height, ost->frame->data,&#xA;                ost->frame->linesize);&#xA;  } else&#xA;    fillRGBImage(ost->frame, c->width, c->height, pixels);&#xA;&#xA;  ost->frame->pts = ost->nextPts&#x2B;&#x2B;;&#xA;&#xA;  return ost->frame;&#xA;}&#xA;&#xA;int writeVideoFrame(AVFormatContext *formatContext,&#xA;                    OutputStream *ost,&#xA;                    const std::vector<glubyte>&amp; pixels,&#xA;                    int duration) {&#xA;  return writeFrame(formatContext,&#xA;                    ost->enc,&#xA;                    ost->st,&#xA;                    getVideoFrame(ost, pixels, duration),&#xA;                    ost->tmpPkt);&#xA;}&#xA;&#xA;void closeStream(AVFormatContext *formatContext, OutputStream *ost) {&#xA;  avcodec_free_context(&amp;ost->enc);&#xA;  av_frame_free(&amp;ost->frame);&#xA;  av_frame_free(&amp;ost->tmpFrame);&#xA;  av_packet_free(&amp;ost->tmpPkt);&#xA;  sws_freeContext(ost->swsContext);&#xA;}&#xA;&#xA;static void fillRGBImage(AVFrame *frame, int width, int height,&#xA;                         const std::vector<glubyte>&amp; pixels) {&#xA;  // Copy pixel data into the frame&#xA;  int inputLineSize{ 3 * width };  // 3 bytes per pixel for RGB&#xA;  for (int y{ 0 }; y &lt; height; &#x2B;&#x2B;y) {&#xA;    memcpy(frame->data[0] &#x2B; y * frame->linesize[0],&#xA;           pixels.data() &#x2B; y * inputLineSize,&#xA;           inputLineSize);&#xA;  }&#xA;}&#xA;</glubyte></glubyte></glubyte></glubyte></string></glubyte></glubyte></glubyte></iostream>

    &#xA;

  • 7 Reasons to Migrate from Google Analytics to Matomo Now

    15 mai 2022, par Erin

    The release of Google Analytics 4 (GA4), and the subsequent depreciation of Universal Analytics, has caused a stir amongst webmasters, SEO experts, marketers and the likes.

    Google’s Universal Analytics is the most widely used web analytics platform in the world, but from 1 July 2023, it will no longer process any new data. Google is now pushing users to set up GA4 tracking imminently.

    If you’re like many and wondering if you should upgrade to Google Analytics 4, there are two key reasons why this might be a risk :

    1. GDPR violations : recent rulings have deemed Google Analytics illegal in France and Austria, and it’s likely that this trend will continue across the EU.
    2. Data loss : users switching to Google Analytics 4 can’t migrate their data from Universal Analytics.

    To mitigate these risks, many organisations are looking to switch to a Google Analytics alternative like Matomo. This is an ideal option for organisations that want to take ownership of their data, get compliant with privacy regulations and save themselves the stress of Google deprecating the software they rely on.

    Whilst there are two major reasons to steer clear of Google Analytics 4, there are 7 reasons why migrating to Matomo instead could save your business time, money and peace of mind.

    If you want to avoid the pitfalls of GA4 and are thinking about migrating from Universal Analytics to Matomo, here’s why you should make the switch now.

    1. Keep your historical Universal Analytics data

    Users switching to Google Analytics 4 will be disappointed to find out that GA4 does not accept data imports from Universal Analytics. On top of that, Google also announced that after Universal Analytics stops processing new data (1 July 2023), users will only be able to access this data for “at least six months”. 

    Years of valuable insights will be completely wiped and organisations will not be able to report on year over year results.

    Fortunately, any organisation using Universal Analytics can import this data into Matomo using our Google Analytics Importer plugin. So you can reduce business disruptions and retain years of valuable web analytics data when you switch to Matomo.

    Our comprehensive migration documentation features a handy video, written guides and FAQs to ensure a smooth migration process.

    2. Ease of use

    Web analytics is complicated enough without having to navigate confusing platform user interfaces (UIs). One of GA4’s biggest drawbacks is the “awful and unusable” interface which has received an overwhelming amount of negative backlash online. 

    Matomo’s intuitive UI contains many of the familiar features that made Universal Analytics so well-liked. You’ll find the same popular features like Visitors, Behaviour, and Acquisition to name a few.

    Behaviour User Flow in Matomo

    User Flow in Matomo

    When you switch to Matomo you can get up to speed quickly and spend more time focusing on high-value tasks, rather than learning about everything new in GA4.

    3. 100% accurate unsampled data

    GA4 implements data sampling and machine learning to fill gaps. Often what you are basing critical business decisions on is actually an estimate of activity. 

    Matomo does not use data sampling, so this guarantees you will always see the full picture.

    “My primary reason to use Matomo is to get the unsampled data, [...] if your website gets lots of traffic and you can’t afford an enterprise level tool like GA premium [GA360] then Matomo is your best choice.”

    Himanshu Sharma, Digital Marketing Consultant & Founder at Optimize Smart.

    With Matomo you can be confident your data-driven decisions are being made with real data.

    4. Privacy by design

    Built-in privacy has always been at the core of Matomo. One key method we use to achieve this, is by giving you 100% data ownership of your web analytics data. You don’t ever have to worry about the data landing in the wrong hands or being used in unethical ways – like unsolicited advertising. 

    On the contrary, Google Analytics is regularly under fire for controversial uses of data. While Google has made changes to make GA4 more privacy-focused, it’s all just smoke and mirrors. The data collected from Google Analytics accounts is used by Google to create digital profiles on internet users, which is then used for advertising. 

    Consumers are becoming increasingly concerned about how businesses are using their data. Businesses that develop privacy strategies, utilise privacy-focused tools will gain a competitive advantage and a loyal customer-base. 

    Prioritise the protection of your user data by switching to a privacy-by-design analytics solution.

    5. Compliance with global privacy laws

    To date, Google Analytics has been deemed illegal to use in France and Austria due to data transfers to the US. Upgrading to GA4 doesn’t make this problem go away either since data is still transferred to the US. 

    Matomo is easily configured to follow even the strictest of privacy laws like GDPR, HIPAA, CCPA, LGPD and PECR. Here’s how :

    Matomo can also be used without cookie consent banners (unlike with Google Analytics, which will always need user consent to track). Matomo has been approved by the French Data Protection Authority (CNIL) as one of the select few web analytics tools that can be used to collect data without tracking consent.

    Every year more countries are drafting legislation that mirrors the European Union’s GDPR (like the Brazilian LGPD). Matomo is designed to stay data-privacy law compliant, and always will be.

    Stay on top of global privacy laws and reduce the time you spend on compliance by switching to a privacy-compliant solution. 

    6. All-in-one web analytics

    Matomo gives you easy access to Heatmaps, Session Recordings, A/B testing, Funnels analytics, and more right out of the box. This means that digital marketing, UX and procurement teams won’t need to set up and manage multiple tools for behavioural analytics – it’s all in one place.

    Learn more about your audience, save money and reduce complexity by switching to an all-in-one analytics solution.

    Check out Matomo’s extensive product features.

    Heatmaps in Matomo

    Page Scroll Depth in Matomo

    7. Tag Manager built-in

    Unlike GA4, the Matomo Tag Manager comes built-in for an efficient and consistent user experience. Matomo Tag Manager offers a pain-free solution for embedding tracking codes on your website without needing help from a web developer or someone with technical knowledge.

    Help your Marketing team track more website actions and give time back to your web developer by switching to Matomo Tag Manager.

    Final Thoughts

    Google Analytics is free to use, but the surrounding legal issues with the platform and implications of switching to GA4 will make migrating a tough choice for many businesses. 

    Now is the chance for organisations to step away from the advertising tech giant, take ownership of web analytics data and get compliant. Switch to the leading Google Analytics alternative and see why over 1 million websites choose Matomo for their web analytics.

    Ready to get started with your own Google Analytics to Matomo migration ? Try Matomo free for 21 days now – no credit card required. 

  • Attribution Tracking (What It Is and How It Works)

    23 février 2024, par Erin

    Facebook, TikTok, Google, email, display ads — which one is best to grow your business ? There’s one proven way to figure it out : attribution tracking.

    Marketing attribution allows you to see which channels are producing the best results for your marketing campaigns.

    In this guide, we’ll show you what attribution tracking is, why it’s important and how you can leverage it to accelerate your marketing success.

    What is attribution tracking ?

    By 2026, the global digital marketing industry is projected to reach $786.2 billion.

    With nearly three-quarters of a trillion U.S. dollars being poured into digital marketing every year, there’s no doubt it dominates traditional marketing.

    The question is, though, how do you know which digital channels to use ?

    By measuring your marketing efforts with attribution tracking.

    What is attribution tracking?

    So, what is attribution tracking ?

    Attribution tracking is where you use software to keep track of different channels and campaign efforts to determine which channel you should attribute conversion to.

    In other words, you can (and should) use attribution tracking to analyse which channels are pushing the needle and which ones aren’t.

    By tracking your marketing efforts, you’ll be able to accurately measure the scale of impact each of your channels, campaigns and touchpoints have on a customer’s purchasing decision.

    If you don’t track your attribution, you’ll end up blindly pouring time, money, and effort into activities that may or may not be helpful.

    Attribution tracking simply gives you insight into what you’re doing right as a marketer — and what you’re doing wrong.

    By understanding which efforts and channels are driving conversions and revenue, you’ll be able to properly allocate resources toward winning channels to double down on growth.

    Matomo lets you track attribution across various channels. Whether you’re looking to track your conversions through organic, referral websites, campaigns, direct traffic, or social media, you can see all your conversions in one place.

    Try Matomo for Free

    Get the web insights you need, without compromising data accuracy.

    No credit card required

    Why attribution tracking is important

    Attribution tracking is crucial to succeed with your marketing since it shows you your most valuable channels.

    It takes the guesswork out of your efforts.

    You don’t need to scratch your head wondering what made your campaigns a success (or a failure).

    While most tools show you last click attribution by default, using attribution tracking, or marketing attribution, you can track revenue and conversions for each touchpoint.

    For example, a Facebook ad might have no led to a conversion immediately. But, maybe the visitor returned to your website two weeks later through your email campaign. Attribution tracking will give credit over longer periods of time to see the bigger picture of how your marketing channels are impacting your overall performance.

    Here are five reasons you need to be using attribution tracking in your business today :

    Why attribution tracking is important.

    1. Measure channel performance

    The most obvious way attribution tracking helps is to show you how well each channel performs.

    When you’re using a variety of marketing channels to reach your audience, you have to know what’s actually doing well (and what’s not).

    This means having clarity on the performance of your :

    • Emails
    • Google Ads
    • Facebook Ads
    • Social media marketing
    • Search engine optimisation (SEO)
    • And more

    Attribution tracking allows you to measure each channel’s ROI and identify how much each channel impacted your campaigns.

    It gives you a more accurate picture of the performance of each channel and each campaign.

    With it, you can easily break down your channels by how much they drove sales, conversions, signups, or other actions.

    With this information, you can then understand where to further allocate your resources to fuel growth.

    2. See campaign performance over longer periods of time

    When you start tracking your channel performance with attribution tracking, you’ll gain new insights into how well your channels and campaigns are performing.

    The best part — you don’t just get to see recent performance.

    You get to track your campaign results over weeks or months.

    For example, if someone found you through Google by searching a question that your blog had an answer to, but they didn’t convert, your traditional tracking strategy would discount SEO.

    But, if that same person clicked a TikTok ad you placed three weeks later, came back, and converted — SEO would receive some attribution on the conversion.

    Using an attribution tracking tool like Matomo can help paint a holistic view of how your marketing is really doing from channel to channel over the long run.

    Try Matomo for Free

    Get the web insights you need, without compromising data accuracy.

    No credit card required

    3. Increase revenue

    Attribution tracking has one incredible benefit for marketers : optimised marketing spend.

    When you begin looking at how well your campaigns and your channels are performing, you’ll start to see what’s working.

    Attribution tracking gives you clarity into the performance of campaigns since it’s not just looking at the first time someone clicks through to your site. It’s looking at every touchpoint a customer made along the way to a conversion.

    By understanding what channels are most effective, you can pour more resources like time, money and labour into those effective channels.

    By doubling down on the winning channels, you’ll be able to grow like never before.

    Rather than trying to “diversify” your marketing efforts, lean into what’s working.

    This is one of the key strategies of an effective marketer to maximise your campaign returns and experience long-term success in terms of revenue.

    4. Improve profit margins

    The final benefit to attribution tracking is simple : you’ll earn more profit.

    Think about it this way : let’s say you’re putting 50% of your marketing spend into Facebook ads and 50% of your spend into email marketing.

    You do this for one year, allocating $500,000 to Facebook and $500,000 to email.

    Then, you start tracking attribution.

    You find that your Facebook ads are generating $900,000 in revenue. 

    That’s a 1,800% return on your investment.

    Not bad, right ?

    Well, after tracking your attribution, you see what your email revenue is.

    In the past year, you generated $1.7 million in email revenue.

    That’s a 3,400% return on your investment (close to the average return of email marketing across all industries).

    In this scenario, you can see that you’re getting nearly twice as much of a return on your marketing spend with email.

    So, the following year, you decide to go for a 75/25 split.

    Instead of putting $500,000 into both email and Facebook ads and email, you put $750,000 into email and $250,000 into Facebook ads.

    You’re still diversifying, but you’re doubling down on what’s working best.

    The result is that you’ll be able to get more revenue by investing the same amount of money, leaving you with higher profit margins.

    Different types of marketing attribution tracking

    There are several types of attribution tracking models in marketing.

    Depending on your goals, your business and your preferred method, there are a variety of types of attribution tracking you can use.

    Here are the six main types of attribution tracking :

    Pros and cons of different marketing attribution models.

    1. Last interaction

    Last interaction attribution model is also called “last touch.”

    It’s one of the most common types of attribution. The way it works is to give 100% of the credit to the final channel a customer interacted with before they converted into a customer.

    This could be through a paid ad, direct traffic, or organic search.

    One potential drawback of last interaction is that it doesn’t factor in other channels that may have assisted in the conversion. However, this model can work really well depending on the business.

    2. First interaction

    This is the opposite of the previous model.

    First interaction, or “first touch,” is all about the first interaction a customer has with your brand.

    It gives 100% of the credit to the channel (i.e. a link clicked from a social media post). And it doesn’t report or attribute anything else to another channel that someone may have interacted with in your marketing mix.

    For example, it won’t attribute the conversion or revenue if the visitor then clicked on an Instagram ad and converted. All credit would be given to the first touch which in this case would be the social media post. 

    The first interaction is a good model to use at the top of your funnel to help establish which channels are bringing leads in from outside your audience.

    3. Last non-direct

    Another model is called the last non-direct attribution model. 

    This model seeks to exclude direct traffic and assigns 100% credit for a conversion to the final channel a customer interacted with before becoming a customer, excluding clicks from direct traffic.

    For instance, if someone first comes to your website from an emai campaignl, and then, a week later, directly visits and buys a product, the email campaign gets all the credit for the sale.

    This attribution model tells a bit more about the whole sales process, shedding some more light on what other channels may have influenced the purchase decision.

    4. Linear

    Another common attribution model is linear.

    This model distributes completely equal credit across every single touchpoint (that’s tracked). 

    Imagine someone comes to your website in different ways : first, they find it through a Google search, then they click a link in an email from your campaign the next day, followed by visiting from a Facebook post a few days later, and finally, a week later, they come from a TikTok ad. 

    Here’s how the attribution is divided among these sources :

    • 25% Organic
    • 25% Email
    • 25% Facebook
    • 25% TikTok ad

    This attirubtion model provides a balanced perspective on the contribution of various sources to a user’s journey on your website.

    5. Position-based

    Position-based attribution is when you give 40% credit to both the first and last touchpoints and 20% credit is spread between the touchpoints in between.

    This model is preferred if you want to identify the initial touchpoint that kickstarted a conversion journey and the final touchpoint that sealed the deal.

    The downside is that you don’t gain much insight into the middle of the customer journey, which can make it hard to make effective decisions.

    For example, someone may have been interacting with your email newsletter for seven weeks, which allowed them to be nurtured and build a relationship with you.

    But that relationship and trust-building effort will be overlooked by the blog post that brought them in and the social media ad that eventually converted them.

    6. Time decay

    The final attribution model is called time decay attribution.

    This is all about giving credit based on the timing of the interactions someone had with your brand.

    For example, the touchpoints that just preceded the sale get the highest score, while the first touchpoints get the lowest score.

    For example, let’s use that scenario from above with the linear model :

    • 25% SEO
    • 25% Email
    • 25% Facebook ad
    • 25% Organic TikTok

    But, instead of splitting credit by 25% to each channel, you weigh the ones closer to the sale with more credit.

    Instead, time decay may look at these same channels like this :

    • 5% SEO (6 weeks ago)
    • 20% Email (3 weeks ago)
    • 30% Facebook ad (1 week ago)
    • 45% Organic TikTok (2 days ago)

    One downside is that it underestimates brand awareness campaigns. And, if you have longer sales cycles, it also isn’t the most accurate, as mid-stage nurturing and relationship building are underlooked. 

    Leverage Matomo : A marketing attribution tool

    Attribution tracking is a crucial part of leading an effective marketing strategy.

    But it’s impossible to do this without the right tools.

    A marketing attribution tool can give you insights into your best-performing channels automatically. 

    What is a marketing attribution tool?

    One of the best marketing attribution tools available is Matomo, a web analytics tool that helps you understand what’s going on with your website and different channels in one easy-to-use dashboard.

    With Matomo, you get marketing attribution as a plug-in or within Matomo On-Premise or for free in Matomo Cloud.

    The best part is it’s all done with crystal-clear data. Matomo gives you 100% accurate data since it doesn’t use data sampling on any plans like Google Analytics.

    To start tracking attribution today, try Matomo’s 21-day free trial. No credit card required.