解説:window.dataLayer = window.dataLayer || [];

解説記事

window.dataLayer = window.dataLayer || [];

について解説します。

<script>
  window.dataLayer = window.dataLayer || [];
  dataLayer.push({
    event: "purchase",
    ecommerce: {
(以下省略)

dataLayerはJavaScriptで「配列」と呼ばれるものになります。

「配列」は中にいろいろな要素をリスト形式で保有することができるもので、

そして「配列」はその要素を追加・削除・検索など行うことが可能です。

dataLayerは「継ぎ足し継ぎ足ししていく」のが本来的な使い方です。

 window.dataLayer = window.dataLayer || [];

は、「dataLayerという名前で配列を新規作成する」というものになります。

GTMはページ上にdataLayerという配列が存在したらそちらを利用する形です。

(存在しない場合はGTMが勝手に作成します)

そして、dataLayer.push()というのは上で触れた「配列に要素を追加する」ものとなり、()の中身をdataLayerに追加する、という文法になっています。 これによって、たとえば「event: “purchase”」の場合は、「作成した配列に対してpurchase用のデータを追加する」形になります。

関連記事

特集記事

コメント

  1. Thaank you a llot ffor sharing this with all people you actuazlly know wbat you’re speaking approximately!
    Bookmarked. Kindly additionally consult with my site =). We could have a hyperlink alternate agreement among us

  2. It’s awesome for me to hae a website, which is valuiable in faavor of myy experience.
    thanhks admin

  3. Attractiive section of content. I just stumbled upon your blog and in accessin caapital to
    ssert that I acquikre actually enjoyed account yur blog
    posts. Anyway I will be subscribing tto your feeds andd even I achievement you access
    coknsistently fast.

  4. Appreciation to my father whho stated to me about
    this webpage, this webpage is in fact amazing.

  5. What a aterial off un-ambiguity andd preserveness of precious
    knowledge on tthe topiic off unexpected feelings.

  6. Wow! Finaoly I got a web site frfom where I bbe capable oof geenuinely
    get helpful factrs regarding my study and knowledge.

  7. Great post.

  8. Heya i’m foor tthe first time here. I cqme acroes this board andd I find It realoy useful & it helped me out
    a lot. I ope to give something baxk annd aiid others like yyou aided me.

  9. wow, awesome blog post.Much thanks again. Great.

  10. Appreciate you sharing, great article post.Really looking forward to read more. Awesome.

  11. Fantastic blog post.Really thank you! Cool.

  12. Very neat blog post.Really looking forward to read more. Want more.

  13. Thanks for the blog article.Really looking forward to read more. Really Cool.

  14. I have realized that over the course of building a relationship with real estate proprietors, you’ll be able to get them to understand that, in most real estate transaction, a percentage is paid. Eventually, FSBO sellers tend not to “save” the payment. Rather, they try to earn the commission by simply doing a great agent’s work. In this, they spend their money and time to complete, as best they could, the responsibilities of an realtor. Those tasks include uncovering the home by means of marketing, introducing the home to all buyers, creating a sense of buyer desperation in order to trigger an offer, arranging home inspections, handling qualification check ups with the loan company, supervising fixes, and facilitating the closing.

  15. In line with my study, after a foreclosures home is sold at a sale, it is common for any borrower to be able to still have a remaining unpaid debt on the mortgage loan. There are many creditors who try and have all fees and liens repaid by the subsequent buyer. Nevertheless, depending on a number of programs, legislation, and state laws and regulations there may be many loans which aren’t easily solved through the switch of lending options. Therefore, the responsibility still falls on the debtor that has had his or her property in foreclosure. Thank you sharing your opinions on this website.

  16. I know this if off topic but I’m looking into starting my own blog and was wondering what all is needed to get setup? I’m assuming having a blog like yours would cost a pretty penny? I’m not very web smart so I’m not 100 certain. Any tips or advice would be greatly appreciated. Cheers

  17. I?d have to check with you here. Which isn’t one thing I often do! I get pleasure from studying a put up that can make people think. Additionally, thanks for allowing me to comment!

  18. Thanks for the different tips discussed on this web site. I have noticed that many insurance carriers offer prospects generous special discounts if they decide to insure a couple of cars with them. A significant variety of households possess several cars these days, in particular those with old teenage young children still located at home, as well as savings for policies can easily soon mount up. So it pays to look for a bargain.

  19. This really answered my downside, thank you!

  20. A lot of what you say happens to be supprisingly precise and it makes me ponder why I had not looked at this in this light before. This particular piece truly did turn the light on for me personally as far as this specific subject matter goes. However there is actually one point I am not too cozy with so whilst I make an effort to reconcile that with the actual core idea of the position, permit me observe exactly what all the rest of the subscribers have to say.Nicely done.

  21. Thanks for your advice on this blog. 1 thing I would want to say is always that purchasing consumer electronics items from the Internet is certainly not new. In reality, in the past decades alone, the marketplace for online electronic products has grown a great deal. Today, you will find practically virtually any electronic device and gizmo on the Internet, from cameras plus camcorders to computer parts and video games consoles.

  22. One thing I would really like to say is car insurance termination is a feared experience so if you’re doing the best things as being a driver you may not get one. A lot of people do receive the notice that they’ve been officially dumped by their particular insurance company they have to struggle to get more insurance following a cancellation. Low-cost auto insurance rates are generally hard to get following a cancellation. Knowing the main reasons for auto insurance termination can help drivers prevent burning off one of the most vital privileges accessible. Thanks for the concepts shared through your blog.

  23. I discovered more new things on this losing weight issue. 1 issue is a good nutrition is especially vital if dieting. A big reduction in fast foods, sugary food, fried foods, sugary foods, beef, and white colored flour products may be necessary. Retaining wastes harmful bacteria, and toxins may prevent targets for fat loss. While certain drugs momentarily solve the situation, the nasty side effects aren’t worth it, and they never present more than a short-lived solution. It is a known fact that 95 of fad diets fail. Many thanks sharing your ideas on this website.

  24. I have observed that online education is getting well-liked because attaining your college degree online has become a popular choice for many people. A lot of people have not necessarily had an opportunity to attend a regular college or university but seek the improved earning possibilities and career advancement that a Bachelors Degree offers. Still people might have a college degree in one training but would wish to pursue one thing they already have an interest in.

  25. Thanks for revealing your ideas in this article. The other issue is that whenever a problem develops with a personal computer motherboard, individuals should not go ahead and take risk of repairing the item themselves for if it is not done correctly it can lead to irreparable damage to the whole laptop. Most commonly it is safe just to approach a dealer of your laptop for your repair of motherboard. They will have technicians who have an competence in dealing with mobile computer motherboard problems and can have the right analysis and execute repairs.

  26. Muchos Gracias for your blog article. Fantastic.

  27. Almanya’nın en iyi medyumu haluk hoca sayesinde sizlerde güven içerisinde çalışmalar yaptırabilirsiniz, 40 yıllık uzmanlık ve tecrübesi ile sizlere en iyi medyumluk hizmeti sunuyoruz.

  28. http://www.thebudgetart.com is trusted worldwide canvas wall art prints & handmade canvas paintings online store. Thebudgetart.com offers budget price & high quality artwork, up-to 50 OFF, FREE Shipping USA, AUS, NZ & Worldwide Delivery.

ランキング(週間)

  1. 1

    GA4 「ページ ロケーション」と「ページ パス と スクリーン クラス」何が違う?ドメインの有無以外にもパラメータの扱いに違いあり

  2. 2

    GA4の探索で「ページ別訪問数」を見ることは可能か?

  3. 3

    GA4のレポート画面の数値データは、イベント発生時から何時間後に確定するのか?

  4. 4

    GA4の指標「総ユーザー数」VS「アクティブ ユーザー数」

  5. 5

    GA4 拡張計測機能の新顔「フォームの操作」 form_start, form_submit

  6. 6

    【祝・GPT-4 が ChatGPT plus に登場記念!】アクセス解析コンサルタントが、GPT-4にCSVデータを渡して、データ解析結果のコメントを書いてもらう方法

  7. 7

    Ads Data Hub(ADH) とはどんなものですか?GA4との関連は?

  8. 8

    GA4で異なるドメイン(サブドメイン)の同一ページパスをドメイン付きで表示する

  9. 9

    GA4 「ユーザー コンバージョン率」「セッションのコンバージョン率」の算出方法は?(2022年8月23日更新)

  10. 10

    GA4では、utm_term, utm_content はどうなったのか?

最近の記事

  1. 生成AIを調整してABテストを実装したら想像以上に早かった

  2. 無料で使えるABテストツールのバージョンアップを行いました

  3. 無料ABテストツール(and,B)のマニュアルを作成しました

カテゴリー

 
TOP