Collecting tag data from frames requires special consideration. It is not normally necessary to send a tag from a frame, but in some cases content in the frame requires tags.
For example: Tracking product reviews submitted or viewed within a child frame. If for technical reasons the Page View tag for the page cannot be sent from the parent document, the Page View tag can be sent from one of the child frames. As each new frame is a new document with a new variable scope, care must be taken to implement tags in child frames correctly.
Referral URL and Query String parameters
Framed pages that are sending a
Page View tag might require the inclusion of an additional Digital Analytics library file within the parent frameset: cmframeset.js.
The cmframeset.js file contains code that properly sets the referring URL and passes on important query string parameters from the parent frameset to the first
View of its children. This file only needs to be included in a frame source if the Page View for the page is sent from the frame. If the
Page View tag for this page is sent from the top-level parent document, cmframeset.js is not needed.
Marketing Management Center (MMC)
cm_mmc= query string parameters are a good example. An external campaign that points to a framed page sending a
Page View tag needs to contain
cm_mmc= parameters within its query strings so that clickthroughs and activity are attributed to the campaign. These parameters must be captured by the first
Page View in the visitor’s session. The parent document contains the MMC parameters in its destination URL but does not send the
Page View tag, therefore the MMC parameters must be passed on to one of the child frames that do send the
View tag for this page. The cmframeset.js file contains code to parse out the MMC parameters and attach them to the URL of the first
Page View tag that is called in any child frameset. This enables correct MMC tracking.
Note: Contact Acoustic Support to request the cmframeset.js file if required.
Sending tags from frames
Every child frame is a new document with a new variable scope. Therefore, each child frame that sends tags must include the Digital Analytics
src= library and
cmSetClientID script blocks. This requirement applies to both first-party and third-party frames.
Ensuring that child frames include Digital Analytics
src= library and
cmSetClientID script blocks prevent cross-domain and undefined function errors, by ensuring that tag library functions are defined within the new document. The
cmSetClientID(...) function call in a new third-party frame must reference the third-party domain in parameter 4 (Cookie Domain).
Third-party frames cannot access the parent frame due to cross-domain scripting limitations imposed by browsers. Therefore, it is not possible to use cmframeset.js to transfer referring URL query string parameters from the parent frame to a
Page View tag in the third-party child frame. In this case, the
Page View tag must be sent from the parent document to ensure that marketing program information can be captured.
Note: An example of including the eluminate.js and cmSetClientID(...) script blocks required to send tags from a child frame is as follows:
<html> <frameset cols="50%,50%"> <frame src="https://www.reviewservice.com/productReview.html" name="body"> </frameset> </html>
Note: In this example, the source of https://www.reviewservice.com/productReview.html must include the eluminate.js library and cmSetClientID call script blocks, specifying the correct data collection method, data collection domain, and cookie domain reviewservice.com:
Note: An example of including the cmframeset.js file in a page where the Page View tag is sent from one of the frame src= HTML documents:
Article is closed for comments.