Skip to content

Commit

Permalink
Re-add some of the Ophan code and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
deedeeh committed Jun 5, 2024
1 parent 491f0d9 commit fadbbc5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
11 changes: 11 additions & 0 deletions applications/app/views/videoEmbed.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@
config: @Html(templates.js.javaScriptConfig(model.SimpleContentPage(video)).body),
adBlockers: { onDetect: [] }
};
@* Decide the Ophan PV ID here so we can share it with Google Analytics *@
guardian.config.ophan = {
// This is duplicated from
// https://github.com/guardian/ophan/blob/master/tracker-js/assets/coffee/ophan/transmit.coffee
// Please do not change this without talking to the Ophan project first.
pageViewId: new Date().getTime().toString(36) + 'xxxxxxxxxxxx'.replace(/x/g, function () {
return Math.floor(Math.random() * 36).toString(36);
})
};
@* Find the Ophan browser ID as well, for sharing with GA *@
@Html(templates.inlineJS.nonBlocking.js.ophanConfig().body)

var docClass = document.documentElement.className;

Expand Down
4 changes: 2 additions & 2 deletions common/app/conf/switches/ABTestSwitches.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ trait ABTestSwitches {
"Test MPU when there is no epic at the end of Article on the page.",
owners = Seq(Owner.withEmail("[email protected]")),
safeState = Off,
sellByDate = Some(LocalDate.of(2024, 7, 31)),
sellByDate = Some(LocalDate.of(2024, 5, 31)),
exposeClientSide = true,
)

Expand All @@ -51,7 +51,7 @@ trait ABTestSwitches {
"Show new ad block ask component in ad slots when we detect ad blocker usage",
owners = Seq(Owner.withEmail("[email protected]")),
safeState = Off,
sellByDate = Some(LocalDate.of(2024, 7, 31)),
sellByDate = Some(LocalDate.of(2024, 5, 31)),
exposeClientSide = true,
)

Expand Down
6 changes: 6 additions & 0 deletions common/app/model/meta.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import conf.Configuration
import conf.cricketPa.CricketTeams
import model.liveblog.Blocks
import model.meta.{Guardian, LinkedData, PotentialAction, WebPage}
import org.apache.commons.lang3.StringUtils
import org.joda.time.DateTime
import com.github.nscala_time.time.Implicits._
import play.api.libs.json._
Expand Down Expand Up @@ -450,6 +451,11 @@ case class MetaData(
.getOrElse(Nil)

def iosId(referrer: String): Option[String] = iosType.map(iosType => s"$id?contenttype=$iosType&source=$referrer")

/**
* Content type, lowercased and with spaces removed.
*/
def normalisedContentType: String = StringUtils.remove(contentType.map(_.name.toLowerCase).getOrElse(""), ' ')
}

object Page {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let loc = document.location;

const trackInternalLinkClick = (spec) => {
// Store in session storage.
// Omniture will both pick it up on next page load,
// Omniture will pick it up on next page load,
// then Omniture will remove it from storage.
const storeObj = {
path: loc.pathname,
Expand Down

0 comments on commit fadbbc5

Please sign in to comment.