npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@deepjs/utm

v0.2.9

Published

处理 utm 参数

Downloads

3

Readme

@deepjs/utm

广告标识 utm 参数,外部流量投放使用,不要内部投放使用

主要作用是用于追踪流量来源,根据不同的参数来统计不同渠道、不同内容的数据细分,有助于精细化的运营分析,多用于广告投放来源参数设置,能够帮助对比区分优劣渠道,有助于判断流量在转换计算等

Usage

import utm from '@deepjs/utm';

utm.set({utm_source: 'baidu', utm_medium: '', spm: 'alipay', utm_content: null})

utm.get()
// {utm_source: 'baidu', utm_medium: '', utm_content: null}

一些说明

  • 数据及维护很容易出问题,所以需要使用网址构建器

  • UTM参数是大小写敏感的,推荐使用小写

  • utm_source: '', // 广告来源,标识来自哪个渠道(必选字段,如无此字段仅有其他字段是不生效的)

    • 如 搜索引擎 头条 utm_source=google
    • 投放的网站
  • utm_medium: '', // 广告媒介,标识来自何种媒介或位置,

    • 如 电子邮件或每次点击付费 (有些渠道默认就被划分为社交媒体,如 facebook,twitter,google+,wechat)
    • 放在 banner 上还是文字超链接上
    • utm_medium=social/social-network/social-media/sm/social+network/social+media
    • 投放的位置
  • utm_campaign: '', // 广告名称,标识推广的主题,标识特定的产品促销活动或战略性广告等名称

    • 如 utm_campaign=spring_sale
    • 投放的活动名称,如双十一
  • utm_content: '', // 广告内容,标识同一推广主题下的不同版本或不同内容,用于 A/B 测试和按内容定位的广告

    • (指向同一网址的广告或链接,但投放关键字不同)
    • 如 utm_content=textlink
    • 投放的内容
  • utm_term: '', // 广告(推广)关键字,标识推广所使用的关键字,常用于搜索引擎付费推广,

    • 如 utm_term=running+shoes
    • 投放的关键字

举例

https://xxx.com?
  utm_source=pengyouquan& // 来源:朋友圈/今日头条/baidu/zhihu/线下投放:offline
  utm_medium=SNS&         // 媒介:普通社交媒体:social/email/付费社交媒体:paid-social
  utm_campaign=tryfree&   // 活动:免费试用/双十一推广/
  utm_content=A&          // 内容:A/B
  utm_term=cuxiao         // 关键字:促销或付费搜索的关键字
  1. 当这条链接用于付费推广时,可以这样定义:

    https://xxx.com?
      utm_source=baidu&       // 投放在百度
      utm_medium=cpc&         // 广告类型是点击付费
      utm_campaign=tryfree&   // 推广名称是 tryfree
      utm_content=textlink&   // 广告内容是 textlink
      utm_term=免费使用        // 广告关键字是 免费试用
  2. 当这条链接用于内容文章时,可以这样定义:

    https://xxx.com?
      utm_source=social&          // 这条链接投放在社交渠道上
      utm_medium=weixin1&         // 放在微信首条的阅读原文里
      utm_campaign=analysis&      // 讲的是分析方法
      utm_content=snslysis_url&   // 内容是链接的分析方法
      utm_term=analysis           // 关键字是 analysis
  3. 当这条链接用于活动时,可以这样定义:

    https://xxx.com?
      utm_source=xxx&             // 广告投放在 xxx 活动中
      utm_medium=QRcode&          // 是试用二维码形式展现
      utm_campaign=621xxx&        // 投放在 6月 21 日 xxx 活动中
      utm_content=wxq1&           // 这条二维码分享在了微信活动群 1 中,供大家扫描
      utm_term=wxq1               // 关键字是 wxq1
  4. 其他

    - www.a.com/?utm_sourse=baidu&utm_medium=cpc&utm_campaign=双11&utm_content=优惠信息&utm_term=满100减50
    - https://example.com/?utm_source=facebook.com&utm_medium=display&utm_campaign=summer+sale+2018
  • 如果可能,通常是跟域名作为source
  • 没有使用系统预定义的字段,这个会导致流量归类错误,常用到的一些medium表示使用到的字段,如affiliate, partners, display, social, paid+email, paid+social。

常见问题

  • 用户多次访问网站,以哪次为准?

用户所有的访问和行为均会基于时间序列记录,并且会将每次的访问来源记录在事件的环境属性下,同时也会计算用户的首次来源记入用户属性。

  • 标记的时候是否需要使用5个参数?

utm_source, utm_medium 和 utm_campaign是强烈推荐一起使用的,但官方只要求使用 utm_source 为必须项

可以在广告系列中使用“+”替代词汇的间隔,“+”将会在GA的报告中转化为空格

参考:

  • https://www.ichdata.com/guidelines-for-the-use-of-utm-parameters-for-google-analytics.html
  • https://www.zhihu.com/question/48724061